summaryrefslogtreecommitdiff
path: root/script/encoder
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-10-22 11:42:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-10-22 11:42:13 +0800
commit7891bd1f332b6cff17524b97084d1c05144bbf02 (patch)
tree334b51429d70e43628b112a748eb6c830941011b /script/encoder
parent55a7ae620430ab1c82043e920e1b26bbd9d273ce (diff)
downloadlua-language-server-7891bd1f332b6cff17524b97084d1c05144bbf02.zip
fix #752
Diffstat (limited to 'script/encoder')
-rw-r--r--script/encoder/init.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/script/encoder/init.lua b/script/encoder/init.lua
new file mode 100644
index 00000000..a8f9a8ac
--- /dev/null
+++ b/script/encoder/init.lua
@@ -0,0 +1,24 @@
+local platform = require 'bee.platform'
+local unicode
+
+if platform.OS == 'Windows' then
+ unicode = require 'bee.unicode'
+end
+
+local m = {}
+
+function m.ansi2utf8(text)
+ if not unicode then
+ return text
+ end
+ return unicode.a2u(text)
+end
+
+function m.utf82ansi(text)
+ if not unicode then
+ return text
+ end
+ return unicode.u2a(text)
+end
+
+return m