From 5a4a4188ea6b7796cd4795c84866e8b0db553949 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 3 Sep 2013 13:25:54 +0200 Subject: sync with Context as of 2013-09-03 --- lualibs-unicode.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lualibs-unicode.lua') diff --git a/lualibs-unicode.lua b/lualibs-unicode.lua index 813ffd5..cf0c93d 100644 --- a/lualibs-unicode.lua +++ b/lualibs-unicode.lua @@ -777,11 +777,19 @@ end local _, l_remap = utf.remapper(little) local _, b_remap = utf.remapper(big) +function utf.utf8_to_utf16_be(str) + return char(254,255) .. lpegmatch(b_remap,str) +end + +function utf.utf8_to_utf16_le(str) + return char(255,254) .. lpegmatch(l_remap,str) +end + function utf.utf8_to_utf16(str,littleendian) if littleendian then - return char(255,254) .. lpegmatch(l_remap,str) + return utf.utf8_to_utf16_le(str) else - return char(254,255) .. lpegmatch(b_remap,str) + return utf.utf8_to_utf16_be(str) end end -- cgit v1.2.3