You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment the String.charCodeAt() method is used to get the user script character codes, and it's return value is stored in a Uint8Array.
If the value returned is larger than a byte, as it would happen with some UTF-8 characters, then some of that information is lost and the wrong character is encoded into the hex file.
- Properly encode >1 byte characters, closes#1 (adds text-encoding as a dependency)
- Add test for bytesToStr()
- Fix test for strToBytes(); add 3 byte character test
This bug has been "ported" from the PythonEditor: bbcmicrobit/PythonEditor#60
The code is in the
src/common.ts
file:https://github.com/microbit-foundation/js-microbit-micropython-fs/blob/ee7081de3b29faf91407eb3535bf0b8cc29fb334/src/common.ts#L7-L18
https://github.com/microbit-foundation/js-microbit-micropython-fs/blob/ee7081de3b29faf91407eb3535bf0b8cc29fb334/src/common.ts#L22-L31
The text was updated successfully, but these errors were encountered: