Strange result of String.fromCharCode #1296
Replies: 5 comments
-
Posted at 2019-03-17 by Robin Sun 2019.03.17 @steffen, what version of Espruino is flashed and on which device?
Please post |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-03-17 by Steffen
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-03-18 by @gfwilliams Please could you provide the exact code that gives you the error? I just tried this and it works fine for me with identical firmware on the same device:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-03-18 by Steffen You are right, it works perfectly well on a clean device.
(It was pretty hard to find out how to reproduce the effect.) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-03-19 by @gfwilliams Wow, thanks for narrowing this down. Turns out it's to do with outputting a hex value under 32 but above 7, and THEN outputting under 8. This reliably does it:
It's just been fixed! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-03-17 by Steffen
String.fromCharCode seems to return strange values for codes below 8:
String.fromCharCode(8) -> "\b" (OK) String.fromCharCode(7) -> "\713" (???)
Although
String.fromCharCode(7).length
returns 1 it doesn't seem to be the same as "\x07".What's going on here?
Beta Was this translation helpful? Give feedback.
All reactions