From 43b84a2685ef7de5c9cd178d95286a846e117981 Mon Sep 17 00:00:00 2001 From: spycat111 Date: Sat, 14 Jun 2025 21:11:51 +0200 Subject: [PATCH] =?UTF-8?q?corrected=20Non=E2=80=91ASCII=20characters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: Non‑ASCII characters cause garbled output and parsing errors The code mixes Unicode punctuation with ASCII. The Bangle.js firmware and Espruino minifier do not handle characters such as the EN DASH “–” and the MINUS SIGN “−”. When the code is minified, the non‑ASCII minus sign corrupts the generated file (crsclock.app.js) and results in: Uncaught SyntaxError: Got UNFINISHED REGEX expected ']' (see crsclock.js lines 612‑614 where the Unicode minus sign is used). The EN DASH also displays incorrectly on the device (rendered as â) when showing the sleep window string (lines 84‑86) and in prompts (lines 714 and 723). References Sleep window string using EN DASH Unicode minus sign in BT calibration menu Prompts using EN DASH for ranges --- apps/crsclock/crsclock.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/crsclock/crsclock.js b/apps/crsclock/crsclock.js index 5a7c1bf9d..e7d5deee2 100644 --- a/apps/crsclock/crsclock.js +++ b/apps/crsclock/crsclock.js @@ -83,7 +83,7 @@ const STATS_FONT_SIZE = 16; function getSleepWindowStr() { let a = ("0"+S.sleepStart).substr(-2) + ":00"; let b = ("0"+S.sleepEnd).substr(-2) + ":00"; - return a + "–" + b; + return a + "-" + b; } function stability(arr, key, hours) { @@ -610,7 +610,7 @@ function calibrateBT() { Bangle.setUI(uiOpts); }); })(d); - m["−" + d + "h"] = (() => () => { + m["-" + d + "h"] = (() => () => { S.phaseOffset -= d; saveSettings(); E.showAlert("Offset now: " + (S.phaseOffset>=0? "+"+S.phaseOffset : S.phaseOffset) + "h").then(() => { @@ -711,7 +711,7 @@ function setBioTimeReference() { E.showMenu(m); function promptRefTime() { - E.showPrompt("Hour (0–23)?").then(h => { + E.showPrompt("Hour (0-23)?").then(h => { if (h===undefined || h<0 || h>23) { E.showAlert("Invalid hour").then(() => { drawClock(); @@ -720,7 +720,7 @@ function setBioTimeReference() { return; } S.bioTimeRefHour = h; - E.showPrompt("Minute (0–59)?").then(m => { + E.showPrompt("Minute (0-59)?").then(m => { if (m===undefined || m<0 || m>59) { E.showAlert("Invalid minute").then(() => { drawClock();