diff --git a/lib/system/reprjs.nim b/lib/system/reprjs.nim index 304ce43107..d04d6e12b1 100644 --- a/lib/system/reprjs.nim +++ b/lib/system/reprjs.nim @@ -55,11 +55,11 @@ proc reprStrAux(result: var string, s: cstring, len: int) = case c of '"': add(result, "\\\"") of '\\': add(result, "\\\\") - of '\10': add(result, "\\10\"\n\"") - of '\127'..'\255', '\0'..'\9', '\11'..'\31': - add( result, "\\" & reprInt(ord(c)) ) + #of '\10': add(result, "\\10\"\n\"") + of '\127'..'\255', '\0'..'\31': + add(result, "\\" & reprInt(ord(c))) else: - add( result, reprInt(ord(c)) ) # Not sure about this. + add(result, c) add(result, "\"") proc reprStr(s: string): string {.compilerRtl.} = diff --git a/tests/js/trepr.nim b/tests/js/trepr.nim index 3f07e67932..366d247c52 100644 --- a/tests/js/trepr.nim +++ b/tests/js/trepr.nim @@ -103,7 +103,7 @@ block strings: when defined js: # C prepends the pointer, JS does not. doAssert(repr(a) == "\"12345\"") doAssert(repr(b) == "\"hello,repr\"") - doAssert(repr(c) == "\"hi\nthere\"") + doAssert(repr(c) == "\"hi\\10there\"") block sets: let