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
micro:bit-support: 21346 Describe the bug
In blocks entering within Serial Write Line, Serial Write String on in a general string assignment, entering a character escape sequence such as “\r” adds extra “\”
If the character required is \”, then two extra \ are added.
Entering a character escape sequence in Javascript gives an unrendered block sometimes.
A round trip from JS to blocks back to JS results in a null being added at the front i.e if the string is “\r” then the round trip results in “” + “\r”
Entering hex number as a character escape crashes program and all work is lost e.g. for control-Z “\0x1a”
There is a documented block https://makecode.microbit.org/reference/math/from-char-code to enter a character code that renders if you use eg let ctrlZ = String.fromCharCode(26) and switched to bklocks, but this doesn't appear in the Text Block menu. Can this be added?
The text was updated successfully, but these errors were encountered:
So Blockly is intentionally adding an extra \ to escape the characters, maybe assuming that children using it are not familiar with the concept, and since it makes problem when communicating with a serial port and they don't have this problem. A quick fix to this would be to handle it in this function:
micro:bit-support: 21346

Describe the bug
In blocks entering within Serial Write Line, Serial Write String on in a general string assignment, entering a character escape sequence such as “\r” adds extra “\”
If the character required is \”, then two extra \ are added.
Entering a character escape sequence in Javascript gives an unrendered block sometimes.

A round trip from JS to blocks back to JS results in a null being added at the front i.e if the string is “\r” then the round trip results in “” + “\r”
Entering hex number as a character escape crashes program and all work is lost e.g. for control-Z “\0x1a”

There is a documented block https://makecode.microbit.org/reference/math/from-char-code to enter a character code that renders if you use eg

let ctrlZ = String.fromCharCode(26)
and switched to bklocks, but this doesn't appear in the Text Block menu. Can this be added?The text was updated successfully, but these errors were encountered: