-
-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
special character on firmware 2v19.62 (seen on Bangle.Js2) #2429
Comments
Thanks - I'll look into it. Just tested and this happens in 2v19 too. How did you hit this? was it with normal code from the app store (eg with German translations), or something you were working on yourself? Just to add that the following works ok, because the string is then not Unicode.
|
I hit this while testing waypoints for espruino/BangleApps#3099 Changing the waypoints.json on the device also changes the umlaut in the file from "ü" (which works) to "\u00FC", somewhere between the require('Storage').readJSON() and writeJSON() call. Might also be a bug? |
Yes, you mean like:
This is a tricky one as if we're actually writing JSON, JSON.stringify is supposed to always write But... I feel like in this case it might be worth ensuring that |
Just fixed that one with 5b06cd6 - this was actually causing some issues with Gadgetbridge, where bitmap-ified text was getting written using unicode escape sequences. |
Cool, thank you very much. |
@gfwilliams I fear this introduced a new problem:
and try to download it with e.g.
you will get
because the string is: seen in multiple interface.html of the Bangle.js app store. |
Argh, ok. That's a pain - for some reason I really thought JSON handled parsing So I'm open to ideas, but I think we could do:
Any thoughts? |
+1 for option 1 with additional compression. Option 3: I see about 22 calls to Util.readStorage() in the Bangle.js app loader, about 16 of them do pass the data to JSON.parse(), so thats definately a pattern. A new function Util.readStorageJSON(filename, defaultValueIfFIleDoesNotExist, callback) would be handy, but that would require an update to a dozen or so interface.html, doable. |
…es to speed up settings read/write see #2429 (comment)
…erface.html over to using it. This allows Bangle.js 2v20 (or cutting edge) and later to store a relaxed 'JSON' on internal storage which (while still normal JS) is smaller and faster (and preserves unicode better) See espruino/Espruino#2429
Yes, that sounds good. Just done this with espruino/BangleApps#3110 Didn't spot your default value request but I made it return |
Awesome, thanks. |
The following snippet containing a german umlaut fails on firmware 2v19.62 on Bangle.Js2:
What I get is:
{ F 8
F 8
"F 8
and a reboot
The text was updated successfully, but these errors were encountered: