You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • 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 to text/html; charset=UTF-8 to get anything useful I think.

About

Avatar for Gordon @Gordon started