corrected Non‑ASCII characters

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
master
spycat111 2025-06-14 21:11:51 +02:00 committed by GitHub
parent 8240c2a1fa
commit 43b84a2685
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -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 (023)?").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 (059)?").then(m => {
E.showPrompt("Minute (0-59)?").then(m => {
if (m===undefined || m<0 || m>59) {
E.showAlert("Invalid minute").then(() => {
drawClock();