由于在 Windows10 上添加了新功能“Beta:使用 Unicode UTF-8 进行全局语言支持”,我认为 R 可以将语言环境转换为 UTF-8。但是,当我尝试通过以下方式将系统区域设置更改为 UTF-8 时
Sys.setlocale(locale = "Japanese_Japan.65001")
或者Sys.setlocale(locale = "Japanese_Japan.UTF-8")
我得到In Sys.setlocale("Japanese_Japan.65001") :
OS reports request to set locale to "Japanese_Japan.65001" cannot be honored
目前,Windows 是否允许 R 使用 UTF-8?(因为我对locale问题不是很熟悉,如果有更多信息欢迎评论。)
信息
> Sys.getlocale()
[1] "LC_COLLATE=Japanese_Japan.932;LC_CTYPE=Japanese_Japan.932;LC_MONETARY=Japanese_Japan.932;LC_NUMERIC=C;LC_TIME=Japanese_Japan.932"
最佳答案
R 似乎已经在 Windows 10 上构建了完全支持 UTF-8 的实验性二进制文件,但由于该项目在 2020 年 7 月 30 日被标记为“实验性”并且官方结论是:
Based also on this experience, I believe that switching to UCRT is already possible and I expect that building a complete toolchain should take a small number of months. It is I think the only realistic way to support Unicode characters (not representable in native encoding) reliably in R on Windows.
这显然意味着在 Windows 上的 R 中完全支持 UTF-8 仍然是一个更遥远的 future 的计划。
来源:https://developer.r-project.org/Blog/public/2020/07/30/windows/utf-8-build-of-r-and-cran-packages/index.html
关于r - Windows 上的 R 中的 UTF-8 支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62726261/