Windows 上 R 中的 UTF-8 支持 [英] UTF-8 support in R on Windows

查看:30
本文介绍了Windows 上 R 中的 UTF-8 支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于在 Windows10 上添加了新功能Beta:使用 Unicode UTF-8 支持全球语言",我认为 R 可以将语言环境转换为 UTF-8.但是,当我尝试将系统语言环境更改为 UTF-8 时,

Since new function 'Beta: Use Unicode UTF-8 for worldwide language support' is added on Windows10, I thought it is possible for R to convert locale environment to UTF-8. However, when I try to change system locale to UTF-8 by

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?

For now, does Windows allow R to use UTF-8?

(由于我对locale问题不是很熟悉,如果有更多信息欢迎评论.)

(Because I am not very familiar with locale problem, I welcome comments if there should be more information.)

信息

> 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-07-30,官方结论是:

It appears that R has built experimental binaries that fully support UTF-8 on Windows 10, but since the project was marked as "experimental" as of 2020-07-30 and the official conclusion was:

同样基于这一经验,我相信切换到 UCRT 已经成为可能,并且我预计构建完整的工具链应该需要几个月的时间.这是我认为在 Windows 上的 R 中可靠地支持 Unicode 字符(无法以本机编码表示)的唯一现实方法.

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.

这显然意味着 R 在 Windows 上对 UTF-8 的全面支持仍然是一个更遥远的未来的计划.

It clearly means that full UTF-8 support in R on Windows is still a plan for a bit more distant future.

来源:https://developer.r-project.org/Blog/public/2020/07/30/windows/utf-8-build-of-r-and-cran-packages/index.html

这篇关于Windows 上 R 中的 UTF-8 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆