summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-11-12 14:35:34 +1100
committerdaurnimator <quae@daurnimator.com>2017-11-12 14:35:34 +1100
commit183bbe94cd55fec7c27431b7f4c1339a3186df3f (patch)
tree72726c93556bd4883cb957b3fbcb106d16a9c914
parented7815d9a5da88e7c83a0596fb75249c3ce165ab (diff)
downloadfengari-183bbe94cd55fec7c27431b7f4c1339a3186df3f.tar.gz
fengari-183bbe94cd55fec7c27431b7f4c1339a3186df3f.tar.bz2
fengari-183bbe94cd55fec7c27431b7f4c1339a3186df3f.zip
src/defs.js: the highest unicode codepoint is U+10FFFF
utf8 dropped support for 5 and 6 byte sequences back in 2003 As we're converting from javascript strings (which are utf-16), codepoints above U+10FFFF can't occur anyway
-rw-r--r--src/defs.js15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/defs.js b/src/defs.js
index f76471a..6fb7d3f 100644
--- a/src/defs.js
+++ b/src/defs.js
@@ -203,21 +203,8 @@ const to_luastring = function(str, cache) {
outU8Array[outIdx++] = 0xE0 | (u >> 12);
outU8Array[outIdx++] = 0x80 | ((u >> 6) & 63);
outU8Array[outIdx++] = 0x80 | (u & 63);
- } else if (u <= 0x1FFFFF) {
- outU8Array[outIdx++] = 0xF0 | (u >> 18);
- outU8Array[outIdx++] = 0x80 | ((u >> 12) & 63);
- outU8Array[outIdx++] = 0x80 | ((u >> 6) & 63);
- outU8Array[outIdx++] = 0x80 | (u & 63);
- } else if (u <= 0x3FFFFFF) {
- outU8Array[outIdx++] = 0xF8 | (u >> 24);
- outU8Array[outIdx++] = 0x80 | ((u >> 18) & 63);
- outU8Array[outIdx++] = 0x80 | ((u >> 12) & 63);
- outU8Array[outIdx++] = 0x80 | ((u >> 6) & 63);
- outU8Array[outIdx++] = 0x80 | (u & 63);
} else {
- outU8Array[outIdx++] = 0xFC | (u >> 30);
- outU8Array[outIdx++] = 0x80 | ((u >> 24) & 63);
- outU8Array[outIdx++] = 0x80 | ((u >> 18) & 63);
+ outU8Array[outIdx++] = 0xF0 | (u >> 18);
outU8Array[outIdx++] = 0x80 | ((u >> 12) & 63);
outU8Array[outIdx++] = 0x80 | ((u >> 6) & 63);
outU8Array[outIdx++] = 0x80 | (u & 63);