summaryrefslogtreecommitdiff
path: root/script/encoder
diff options
context:
space:
mode:
Diffstat (limited to 'script/encoder')
-rw-r--r--script/encoder/utf16.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/script/encoder/utf16.lua b/script/encoder/utf16.lua
index 9e71de68..744da174 100644
--- a/script/encoder/utf16.lua
+++ b/script/encoder/utf16.lua
@@ -86,9 +86,17 @@ local function utf8next(s, n)
return n+1, utf8byte(s, n)
elseif strmatch(s, "^[\xC2-\xDF][\x80-\xBF]", n) then
return n+2, utf8byte(s, n)
- elseif strmatch(s, "^[\xE0-\xEF][\x80-\xBF][\x80-\xBF]", n) then
+ elseif strmatch(s, "^[\xE0][\xA0-\xBF][\x80-\xBF]", n) then
return n+3, utf8byte(s, n)
- elseif strmatch(s, "^[\xF0-\xF4][\x80-\xBF][\x80-\xBF][\x80-\xBF]", n) then
+ elseif strmatch(s, "^[\xE1-\xEC][\x80-\xBF][\x80-\xBF]", n) then
+ return n+3, utf8byte(s, n)
+ elseif strmatch(s, "^[\xED][\x80-\x9F][\x80-\xBF]", n) then
+ return n+3, utf8byte(s, n)
+ elseif strmatch(s, "^[\xF0][\x90-\xBF][\x80-\xBF][\x80-\xBF]", n) then
+ return n+4, utf8byte(s, n)
+ elseif strmatch(s, "^[\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]", n) then
+ return n+4, utf8byte(s, n)
+ elseif strmatch(s, "^[\xF4][\x80-\x8F][\x80-\xBF][\x80-\xBF]", n) then
return n+4, utf8byte(s, n)
else
return n+1 --invaild