-
-
Notifications
You must be signed in to change notification settings - Fork 816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Utf8 support #468
Utf8 support #468
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
用于强制 wcstombs/mbstowcs 切到 utf8上去? |
都是char* 处理,你传utf8就是处理utf8 传ansi就是处理ansi,实际最终转换成win api调用的时候,转下不就好了,如果是转的有问题。加上你刚说的 PDC_FORCE_UTF8 去修改 wcstombs/mbstowcs 的行为就行了吧。。 其他地方还要转换什么? |
剩下都差不多了,虽然命令行那里比较丑陋,不过能用 |
11ee818
to
eaf0d01
Compare
rebase 了,先切到dev了 |
差不多了就切到dev分支吧,我已经把那边的更改merge进来了 |
你暂时不用merge dev哈,我还要先merge到 utf8分支下,本地测试,然后做些修饰后,确认没啥问题了,才会去merge dev 我之后我去对dev merge的,这回改动太大。。我还是要在utf8 branch下。。多改改测测的 |
@@ -0,0 +1,80 @@ | |||
function test_read(t) | |||
t:are_equal(io.readfile("files/utf8bom-lf-eleof"), "123\\\n456\n789\n") | |||
t:are_equal(io.readfile("files/utf8-crlf-neleof"), "123\\\n456\n789") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
就是说,现在readfile默认的行为,会对 \r\n
自动处理成 \n
跟 unix下 保持一致?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
以前也会啊,C标准规定了<stdio.h> 里的所有字符串相关函数都需要将 '\n'
看作 Platform specific的换行符,这也是fopen(..,“r”)
和fopen(..,“rb”)
的唯一区别。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在自己读字节流了这个屁股当然也要擦啊,不然全错
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fopen(..,“r”)
和fopen(..,“rb”)
在'\n'做行尾的平台是完全一致的
只是把dev的一些更改合并进来了,到时候你的utf8分支merge进去方便一点 |
嗯,先这样吧,目前初步看了下,没啥大问题,等晚上有时间我在拉下来 测测 其他一些代码风格的修饰,我之后会稍微处理下。。 |
? 什么场景需要dump这个? 有相关reference么? |
这就是相关场景啊,不搞这个直接stackoverflow啊 |
这个跟 _print_anchor |
去看YAML的文档,用的那个语法
不然谁知道*1是那个 |
但是,如果当前没有obj引用,也都全部显示 &x ,比如纯scalar array,这么显示就很莫名了,也不简洁。。 可以当前obj确实被其他obj有引用,才显示对应的 &x,会更好些,不过这样应该需要预先遍历遍,预处理生成下引用关系table |
这部分纯lua实现的啊,怎么还有平台问题 |
不清楚,我先merge到utf8了,等晚上 我再调下这块。。 |
记得拉个dev<-utf8的PR,我来review |
#467
file:read("n")
for disk filesio.read(num)
will not ensure returnsnum
of chars since it readsnum
of utf-16 chars and convert it to utf-8opt
param for most api"binary"
to disable this feature and read as a binary filecontinuation .. "\r\n"
orcontinuation .. "\n"
will be replaced to an empty char sequence in read apis, this option does not affect writingfile:path()
andfile:size()
API.clang-format
file for ./corewinos
winos.ansi_cp()
get ansi codepagewinos.oem_cp()
get oem codepagewinos.cp_info(cp)
get info of a codepagewinos.console_cp(cp)
set console cp, ifcp
not provided, get current console cpwinos.console_output_cp(cp)
set console output cp, ifcp
not provided, get current console output cpwinos.mbstoutf8(cp, data)
convertdata
ofcp
to utf8 stringtable.to_array
methodraw*
method andglobal
method todebug
utils.dump
For xmake developers:
temp file named"null"
and"nullin"
will be used asos.nuldev()
for windowsprint
is not available in ./xmake/core domain, you should useio.write
here