idealvin / coost

A tiny boost library in C++11.
Other
3.91k stars 558 forks source link

fix: [fs] Operate fs failed with non-ASCII file/dir name on WIN. #347

Closed re2zero closed 8 months ago

re2zero commented 8 months ago

On windows platform, if the file/dir name include non-ASCII characters, it can not open this file or read dir. Need to convert the char to widechar and then invoke the wide related functions.

Log: fix operate file failed on win.

re2zero commented 8 months ago

发现在windows上,对含有中文字符的文件或目录进行操作,总是失败,原因是调用的函数 A 只支持ASCII码,改用W 宽字符支持的函数,因此需要转换一下。 目前在Win10上测过,看看有什么更好的建议:)

idealvin commented 8 months ago

这是中文编码问题,std::ofstream 也有这个问题吧?

re2zero commented 8 months ago

这是中文编码问题,std::ofstream 也有这个问题吧?

std::ofstream 没测试过。是中文编码,转换为UTF-8编码的方法,等空了详细测下。 此PR先挂起吧

idealvin commented 8 months ago

这个已经支持了