diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-09-03 04:28:56 -0700 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-09-03 04:28:56 -0700 |
commit | 08311ca818df220f8e59fc0ff5835d18913daa89 (patch) | |
tree | 0274fb1094de1786db3a814346c95fab097259fb /lualibs-unicode.lua | |
parent | 3aacbae713dd9a3468578f56a75b74bb378a7de2 (diff) | |
parent | 5a4a4188ea6b7796cd4795c84866e8b0db553949 (diff) | |
download | lualibs-08311ca818df220f8e59fc0ff5835d18913daa89.tar.gz |
Merge pull request #17 from phi-gamma/master
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 |