-
• #2
This is a constant source of frustration for me. Basically Espruino doesn't directly support unicode since it only has 8 bit characters, so to do anything non-ASCII the IDE replaces anything outside the 0-127 character code range with the escaped utf-8 equivalents before uploading - it's a bit of a hack.
print('Hello World! Привет Мир!') // turns into print('Hello World! \xD0\x9F\xD1\x80\xD0\xB8\xD0\xB2\xD0\xB5\xD1\x82 \xD0\x9C\xD0\xB8\xD1\x80!')
But I just tried it, and it was broken (it's caused problems ever since it was added to the IDE in 2015!). I've just fixed it and the changes will be in the next IDE release.
Although even with that doesn't seem to be interpreted correctly by the IDE's terminal. You may have more luck when it's in a webpage, but the foolproof method would be to use the HTML escape codes for the characters you want.
... although when it is working, you will need to change
Content-Type
totext/html; charset=UTF-8
to get anything useful I think.
Hi everyone! When i trying send some cyrillic text via using
i getting very strange results.
Here is my code:
And that's what i getting in my browser:
"Hello World! AFD0C8C2C5D2 ACC8D0!"
Can someone explain me, what i'm doing wrong? Thanks!