From 2afb966fbfc17c9a084402f5401d0a7b17ad64c3 Mon Sep 17 00:00:00 2001 From: Pavol Bielik Date: Sun, 25 Jan 2015 16:37:14 +0100 Subject: [PATCH] Update encoding. Note that using some unicode characters is broken due to UglifyJS. --- lib/feature_extractor.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/feature_extractor.js b/lib/feature_extractor.js index 4aa2467f..4174d2b9 100644 --- a/lib/feature_extractor.js +++ b/lib/feature_extractor.js @@ -558,9 +558,11 @@ StringMap.prototype.getId = function(input){ /* ------------------------ */ function escapeString(input){ - //escape method escapes certain characters that encodeURIComponent cannot process - //unescape is used to make the resulting string smaller - return unescape(encodeURIComponent(escape(input))); + try { + return encodeURIComponent(input); + } catch (ex){ + throw new Parse_Error(" unable to encode '" + input.replace(/^!(String|Number|RegExp|Atom|Bool')!/, '') + "'"); + } } function parseFile(code, file) {