diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-09-03 13:25:54 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-09-03 13:25:54 +0200 |
commit | 5a4a4188ea6b7796cd4795c84866e8b0db553949 (patch) | |
tree | 0274fb1094de1786db3a814346c95fab097259fb /lualibs-unicode.lua | |
parent | 36085526a0d2e5f35d0c6a9fc4daae0b6b69326f (diff) | |
download | lualibs-5a4a4188ea6b7796cd4795c84866e8b0db553949.tar.gz |
sync with Context as of 2013-09-03
Diffstat (limited to 'lualibs-unicode.lua')
-rw-r--r-- | lualibs-unicode.lua | 12 |
1 files changed, 10 insertions, 2 deletions
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 |