bvasiles/jsNaughty

Unicode In Strings Crashing Renamer

caseycas opened this issue · 1 comments

The Popen.communicate call is failing when there are unicode escape characters in the Javascript passed in. For instance,
`
writeRandomQuote = function() {
var e = new Array();
e[0] = "Action is the real measure of intelligence.";
e[1] = "Baseball has the great advantage over cricket of being sooner ended.";
e[2] = "Every goal, every action, every thought, every feeling one experiences, whether it be consciously or unconsciously known, is an attempt to increase one’s level of peace of mind.";
e[3] = "A good head and a good heart are always a formidable combination.";
var o = Math.floor(Math.random() * e.length);
document.write(e[o]);
};

writeRandomQuote();
`
Causes a crash. This is despite it already having been encoded in utf8 (e.g. it prints file elsewhere.)

Solved temporarily by transliteration with unidecode.