summaryrefslogtreecommitdiff
path: root/lualibs-unicode.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-12-14 14:31:43 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2013-12-14 14:31:43 +0100
commita82cbf2bce00df54f59d1b81805e8b40029b93c6 (patch)
treeda13b16e2ff9c367cff159a3e0f951046ecb1940 /lualibs-unicode.lua
parent3c357e43af3900df8d6de9ec08e05222ea4256eb (diff)
downloadlualibs-a82cbf2bce00df54f59d1b81805e8b40029b93c6.tar.gz
sync with Context as of 2013-12-14
Diffstat (limited to 'lualibs-unicode.lua')
-rw-r--r--lualibs-unicode.lua22
1 files changed, 15 insertions, 7 deletions
diff --git a/lualibs-unicode.lua b/lualibs-unicode.lua
index 7ada394..902f6a0 100644
--- a/lualibs-unicode.lua
+++ b/lualibs-unicode.lua
@@ -935,19 +935,27 @@ 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)
+function utf.utf8_to_utf16_be(str,nobom)
+ if nobom then
+ return lpegmatch(b_remap,str)
+ else
+ return char(254,255) .. lpegmatch(b_remap,str)
+ end
end
-function utf.utf8_to_utf16_le(str)
- return char(255,254) .. lpegmatch(l_remap,str)
+function utf.utf8_to_utf16_le(str,nobom)
+ if nobom then
+ return lpegmatch(l_remap,str)
+ else
+ return char(255,254) .. lpegmatch(l_remap,str)
+ end
end
-function utf.utf8_to_utf16(str,littleendian)
+function utf.utf8_to_utf16(str,littleendian,nobom)
if littleendian then
- return utf.utf8_to_utf16_le(str)
+ return utf.utf8_to_utf16_le(str,nobom)
else
- return utf.utf8_to_utf16_be(str)
+ return utf.utf8_to_utf16_be(str,nobom)
end
end