diff --git a/lib/output.js b/lib/output.js index 42b3aad9..b99bfa63 100644 --- a/lib/output.js +++ b/lib/output.js @@ -72,8 +72,13 @@ function OutputStream(options) { function to_ascii(str) { return str.replace(/[\u0080-\uffff]/g, function(ch) { var code = ch.charCodeAt(0).toString(16); - while (code.length < 4) code = "0" + code; - return "\\u" + code; + if (code.length <= 2) { + while (code.length < 2) code = "0" + code; + return "\\x" + code; + } else { + while (code.length < 4) code = "0" + code; + return "\\u" + code; + } }); };