summaryrefslogtreecommitdiff
path: root/cli/rt/02_console.js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/rt/02_console.js')
-rw-r--r--cli/rt/02_console.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/cli/rt/02_console.js b/cli/rt/02_console.js
index b6f5bc74b..a5e6595b9 100644
--- a/cli/rt/02_console.js
+++ b/cli/rt/02_console.js
@@ -462,7 +462,11 @@
.replace(/\n/g, "\\n")
.replace(/\r/g, "\\r")
.replace(/\t/g, "\\t")
- .replace(/\v/g, "\\v");
+ .replace(/\v/g, "\\v")
+ .replace(
+ /[\x00-\x1f\x7f-\x9f]/g,
+ (c) => "\\x" + c.charCodeAt(0).toString(16).padStart(2, "0"),
+ );
}
// Print strings when they are inside of arrays or objects with quotes