Skip to content

Conversation

@spycat111
Copy link
Contributor

This PR addresses two critical bugs that occur only when installing the app via the development App Loader (they do not appear when uploading the script directly through the Web IDE):

Malformed regex / syntax error

Cause: The source uses the Unicode minus sign (U+2212) in the BT calibration menu, which the Espruino minifier mis-parses and embeds into crsclock.app.js as an unfinished regex.

Symptom:

Uncaught SyntaxError: Got UNFINISHED REGEX expected ']'
Location: crsclock.js ≈ lines 612–614.

Garbled on-device text

Cause: Use of the EN DASH (U+2013) in prompt strings for the sleep window and range selections.

Symptom: Dash characters render as â (mojibake) on Bangle.js.

Locations:

Sleep window label (lines 84–86)

Range prompts (lines 714 & 723)

All non-ASCII dashes have been normalised to the standard ASCII hyphen-minus (-) so that both the Espruino minifier and the Bangle.js firmware handle them correctly.

Changes:

crsclock.js

Replaced all occurrences of U+2013 (EN DASH) and U+2212 (MINUS SIGN) with -

Updated prompt strings and menu labels accordingly

crsclock.app.js (auto-generated; should now minify without errors)

Verification:

Uploaded via App Loader—BT calibration menu works, no syntax errors in console
Sleep-window settings now display 08:00–22:00 (with ASCII hyphen) correctly on the device
Uploaded via Web IDE—unchanged behaviour, as expected

References:

Sleep window string initially using EN DASH (lines 84–86)
Unicode minus sign in BT calibration menu (lines 612–614)
Range prompts using EN DASH (lines 714 & 723)

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
@bobrippling
Copy link
Collaborator

Thanks - looks like there's a hyphen in a comment on line 521 and a unicode copyright on line 746 which might trip things up!

@spycat111
Copy link
Contributor Author

spycat111 commented Jun 15, 2025

I created another PR #3883 for this - Thank you!

Additionally, PR #3882 is also relevant to this.

@bobrippling
Copy link
Collaborator

Thanks!

@bobrippling bobrippling merged commit 8e537b1 into espruino:master Jul 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants