如果路径包含非拉丁字符,则会出错

Shn*_*son 7 perl6

操作系统:Windows 10 Perl6:这是在MoarVM版本2018.04.1上构建的Rakudo Star版本2018.04.1,实现了Perl 6.c.

例:

perl6 C:\Users\quest\Desktop\example.pl
# sucess

perl6 "C:\Users\quest\Desktop\??\Perl 6\web-scraping\request.pl"
# Could not open C:\Users\quest\Desktop\????\Perl 6\web-scraping\request.pl. Failed to open file C:\Users\quest\Desktop\????\Perl 6\web-scraping\request.pl: No such file or directory
Run Code Online (Sandbox Code Playgroud)

Python 3示例:

py "C:\Users\quest\Desktop\??\py\3\timetest.py"
# sucess
Run Code Online (Sandbox Code Playgroud)

Chr*_*oph 5

正如您所意识到的,Windows 10 支持非 Unicode(即非 UTF-16)应用程序的 UTF-8(根据 Wikipedia,此功能是在 2018 年 4 月发布的版本 17035 中添加的,并且仍标记为“测试版”) 。这让拉库多很高兴。

然而,在 Python 设法做到这一点时,不尊重您的语言环境对我来说仍然值得报告错误

  • @raiph,这是微软自己制定的定义。接受或返回字符串的 Windows API 函数有两种类型:ANSI 和 Unicode。ANSI 调用(例如“CreateFileA”)接受/返回使用用户的活动代码页(在美国计算机上通常为 1252)编码的字符串,而 UNICODE 调用(例如“CreateFileW”)接受/返回 UTF-16le。tl,dr:在 Microsoft 世界中,Unicode 表示 UTF-16le。 (2认同)