8000 Fix character escaping · arduino/micropython.js@f25344e · GitHub
[go: up one dir, main page]

Skip to content

Commit f25344e

Browse files
committed
Fix character escaping
1 parent f7d4d85 commit f25344e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

micropython.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ function sleep(millis) {
1212
}
1313

1414
function escape_string(string) {
15-
string = string.replace(/"""/g, `\\"\\"\\"`)
1615
string = string.replace(/\'/g, `\\'`)
1716
string = string.replace(/\"/g, `\\"`)
17+
string = string.replace(/"""/g, `\\"\\"\\"`)
1818
return string
1919
}
2020

@@ -249,7 +249,7 @@ class MicroPythonBoard {
249249
})
250250
await sleep(100)
251251
for (let i = 0; i < content.length; i+=128) {
252-
let slice = content.slice(i, i+128)
252+
let slice = content.subarray(i, i+128)
253253
slice = slice.toString()
254254
slice = escape_string(slice)
255255
await this.serial.write(`w("""${slice}""")`)

0 commit comments

Comments
 (0)
0