summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-26 00:29:53 +0800
committerruki <[email protected]>2021-01-26 21:01:11 +0800
commit5fab0722862b1d519a653846a4a0a39110fe31ac (patch)
tree0f670730097f26c9e9f579b8edb22c83203a8228 /core/src
parent9a816217dc6263c756a28863a38be7e27a5404fa (diff)
improve io.open
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/io/file_open.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/xmake/io/file_open.c b/core/src/xmake/io/file_open.c
index 6ccba9b62..c92380207 100644
--- a/core/src/xmake/io/file_open.c
+++ b/core/src/xmake/io/file_open.c
@@ -207,6 +207,14 @@ tb_int_t xm_io_file_open(lua_State* lua)
encoding = TB_CHARSET_TYPE_UTF16 | TB_CHARSET_TYPE_BE;
else if (tb_strstr(modestr, "utf16") || tb_strstr(modestr, "utf-16"))
encoding = TB_CHARSET_TYPE_UTF16 | TB_CHARSET_TYPE_NE;
+ else if (tb_strstr(modestr, "ansi"))
+ encoding = TB_CHARSET_TYPE_ANSI;
+ else if (tb_strstr(modestr, "gbk"))
+ encoding = TB_CHARSET_TYPE_GBK;
+ else if (tb_strstr(modestr, "gb2312"))
+ encoding = TB_CHARSET_TYPE_GB2312;
+ else if (tb_strstr(modestr, "iso8859"))
+ encoding = TB_CHARSET_TYPE_ISO8859;
else if (modestr[0] == 'w' || modestr[0] == 'a') // set to utf-8 if not specified for the writing mode
encoding = TB_CHARSET_TYPE_UTF8;
else if (modestr[0] == 'r') // detect encoding if not specified for the reading mode