R中的捷克语编码 [英] Czech encoding in R

查看:55
本文介绍了R中的捷克语编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在新计算机上安装了RStudio,并且遇到了编码问题.当我在控制台中键入带重音符号的文本(不涉及文件写入或读取,只是普通的控制台)时,我丢失了捷克语的重音符号(如本例所示,请注意带重音符号的N和Č)

I have installed RStudio on a new computer, and has developed encoding issues. When I type accented text in console (no file writing or reading involved, just plain console) I lose Czech accents (as in this example - notice the accented N and Č)

> "Ňuf ňuf ňufičky"
[1] "Nuf nuf nuficky"

我知道这是一个设置问题-我有其他R装置可以正常运行-但我无法在设置中找到确切的位置来强制执行UTF-8行为.任何帮助将不胜感激.

I know it is a settings issue - I have other R installations that behave correctly - but I am unable to find exact place in my settings to force UTF-8 behavior. Any help would be appreciated.

我的会话信息是:

R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2    yaml_2.1.14   

推荐答案

为了后代的利益-我通过将代码页设置为1250(同时保持美国英语为我的语言)来解决了我的问题.

For the benefit of posterity - I overcame my problem by setting code page to 1250 (while keeping US English as my language).

if (.Platform$OS.type == 'windows') {
  Sys.setlocale(category = 'LC_ALL','English_United States.1250')
} else {
  Sys.setlocale(category = 'LC_ALL','en_US.UTF-8')
}

.Rprofile中的

in the .Rprofile

这篇关于R中的捷克语编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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