aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-11-12 14:29:42 +1100
committerdaurnimator <quae@daurnimator.com>2017-11-12 14:29:50 +1100
commited7815d9a5da88e7c83a0596fb75249c3ce165ab (patch)
treeb787a8ec918d7f27e9b70a641f39b3d76d5e3efa /src
parent3033341b741cfb256baf91acf1f257a7f1ed6f7b (diff)
downloadfengari-ed7815d9a5da88e7c83a0596fb75249c3ce165ab.tar.gz
fengari-ed7815d9a5da88e7c83a0596fb75249c3ce165ab.tar.bz2
fengari-ed7815d9a5da88e7c83a0596fb75249c3ce165ab.zip
src/defs.js: Fix conversion of non-BMP unicode codepoints
Adds tests for to_luastring
Diffstat (limited to 'src')
-rw-r--r--src/defs.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/defs.js b/src/defs.js
index 4d5de3b..f76471a 100644
--- a/src/defs.js
+++ b/src/defs.js
@@ -193,7 +193,7 @@ const to_luastring = function(str, cache) {
// See http://unicode.org/faq/utf_bom.html#utf16-3
// For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description and https://www.ietf.org/rfc/rfc2279.txt and https://tools.ietf.org/html/rfc3629
let u = str.codePointAt(i);
- if (u >= 0xD800) i++; // If it was a surrogate pair it used up two bytes
+ if (u >= 0x10000) i++; // It was a surrogate pair and hence used up two bytes
if (u <= 0x7F) {
outU8Array[outIdx++] = u;
} else if (u <= 0x7FF) {