summaryrefslogtreecommitdiff
path: root/script/encoder/ansi.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/encoder/ansi.lua')
-rw-r--r--script/encoder/ansi.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/script/encoder/ansi.lua b/script/encoder/ansi.lua
new file mode 100644
index 00000000..1016e668
--- /dev/null
+++ b/script/encoder/ansi.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.decode(text)
+ if not unicode then
+ return text
+ end
+ return unicode.a2u(text)
+end
+
+function m.encode(text)
+ if not unicode then
+ return text
+ end
+ return unicode.u2a(text)
+end
+
+return m