Skip to content

Commit

Permalink
Support for super-ASCII weird characters too.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregor Richards authored and Gregor Richards committed Jun 1, 2011
1 parent 712c5fe commit fac34bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/jsdecomp.js
Expand Up @@ -85,15 +85,15 @@ Narcissus.decompiler = (function() {
}

function nodeStr(n) {
if (/[\u0000-\u001F]/.test(n.value)) {
// use the convoluted algorithm to avoid broken low characters
if (/[\u0000-\u001F\u0080-\uFFFF]/.test(n.value)) {
// use the convoluted algorithm to avoid broken low/high characters
var str = "";
for (var i = 0; i < n.value.length; i++) {
var c = n.value[i];
if (c <= "\x1F") {
if (c <= "\x1F" || c >= "\x80") {
var cc = c.charCodeAt(0).toString(16);
if (cc.length === 1) cc = "0" + cc;
str += "\\u00" + cc;
while (cc.length < 4) cc = "0" + cc;
str += "\\u" + cc;
} else {
str += nodeStrEscape(c);
}
Expand Down

0 comments on commit fac34bf

Please sign in to comment.