【发布时间】:2021-06-25 05:22:46
【问题描述】:
我对法语 Windows 10 的口音有疑问
local origin = "D:\temp\test.txt"
local destination = "D:\temp\testé.txt"
local cpTemplate = "copy \""..origin.."\" \""..destination.."\""
os.execute(cpTemplate)
控制台日志正确显示:
copy "D:\temp\test.txt" "D:\temp\testé.txt"
这不会创建“testé.txt”文件,但是:
testé.txt
当然,如果文件夹名称中有重音符号(此处以 D:\temp 为例),则不会复制任何内容
【问题讨论】:
-
而只使用 teste.txt 不是一个选项?在我看来,文件名根本不应该包含任何字符装饰。
-
这是一个例子。在现实生活中,我不能要求用户避免使用重音,这在法语中很常见 :)
-
你的文件保存为UTF8编码,
os.executes使用ansi版本,使用windows-1252编码。在您的情况下,它并不完美,但只能将utf8转换为windows1252,如stackoverflow.com/a/41859181/12918181 或简单地将您的脚本保存为windows1252编码。 -
感谢 Darius 解决了 stackoverflow.com/a/41859181/12918181
-
顺便说一句,这是支持多个代码页的 ANSI-UTF8 转换器的latest version。你需要
utf8_to_win()从那里。
标签: windows lua character-encoding