summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2016-02-24 21:57:34 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2016-02-25 13:21:27 +0100
commitcdc7e025e0d3b9f18403c53d523f99cc91051e58 (patch)
treee66f3b55fc36a32d5f8658ea3b4daa9e4db02605 /tools
parent581606a5fdcdd1fcad6dec1dd182c052dfd71cba (diff)
downloadandroid-node-v8-cdc7e025e0d3b9f18403c53d523f99cc91051e58.tar.gz
android-node-v8-cdc7e025e0d3b9f18403c53d523f99cc91051e58.tar.bz2
android-node-v8-cdc7e025e0d3b9f18403c53d523f99cc91051e58.zip
src,tools: allow utf-8 in built-in js source code
PR-URL: https://github.com/nodejs/node/pull/5418 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/js2c.py23
1 files changed, 3 insertions, 20 deletions
diff --git a/tools/js2c.py b/tools/js2c.py
index ec9705ec6a..9c5878a668 100755
--- a/tools/js2c.py
+++ b/tools/js2c.py
@@ -42,24 +42,7 @@ import jsmin
def ToCArray(filename, lines):
- result = []
- row = 1
- col = 0
- for chr in lines:
- col += 1
- if chr == "\n" or chr == "\r":
- row += 1
- col = 0
-
- value = ord(chr)
-
- if value >= 128:
- print 'non-ascii value ' + filename + ':' + str(row) + ':' + str(col)
- sys.exit(1);
-
- result.append(str(value))
- result.append("0")
- return ", ".join(result)
+ return ','.join(str(ord(c)) for c in lines + '\0')
def CompressScript(lines, do_jsmin):
@@ -220,7 +203,7 @@ namespace node {
struct _native {
const char* name;
- const char* source;
+ const unsigned char* source;
size_t source_len;
};
@@ -242,7 +225,7 @@ NATIVE_DECLARATION = """\
"""
SOURCE_DECLARATION = """\
- const char %(escaped_id)s_native[] = { %(data)s };
+ const unsigned char %(escaped_id)s_native[] = { %(data)s };
"""