以下测试在我的笔记本电脑上正常运行,但在运行Windows 10的HP EliteOne 800上出现错误
H <- "שלום"
H
在遇到问题的机器上
[1]“ùìåí”
我测试了几种编码,例如
Encoding(H) <- "ISO-8859-1"
给出相同的输出,
Encoding(H)<-"UTF-8"
H
产生
[1]“\ xf9 \ xec \ xe5 \ xed”
以下是对
的回复sessionInfo()
R version 3.2.2(2015-08-14)平台:x86_64-w64-mingw32 / x64(64位) 运行于:Windows 8 x64(build 9200)
locale:[1] LC_COLLATE = Hebrew_Israel.1255 LC_CTYPE = Hebrew_Israel.1255 LC_MONETARY = Hebrew_Israel.1255 [4] LC_NUMERIC = C
LC_TIME = Hebrew_Israel.1255附加基础包:[1] stats graphics grDevices utils
数据集方法基础通过命名空间加载(而不是附加):[1] tools_3.2.2
任何帮助将不胜感激,
阿维
答案 0 :(得分:2)
谢谢理查德,你引导我找到了一个有效的解决方案 - 虽然我不明白为什么。我玩了各种代码,不小心将我的语言环境改为日语,工作正常。比我测试了各种其他语言环境,他们做同样的技巧。如果有人知道为什么希伯来语不适用于希伯来语语言环境,我想知道。以下是代码及其产品:
H <- "שלום" H Sys.getlocale() Sys.setlocale("LC_ALL", "Hebrew") H <- "שלום" H Sys.getlocale() Sys.setlocale("LC_ALL", "ja") H <- "שלום" H Sys.setlocale("LC_ALL", "Portuguese_Brazil.1252") H <- "שלום" H Sys.setlocale("LC_ALL", "German") H <- "שלום" H produces the following output, where only the Hebrew locale does not show Hebrew.
H&lt; - “שלום”
ħ
<强>&GT; [1]“ùìåí” #THEHEBE在希伯来语中
Sys.getlocale()
[1] “LC_COLLATE = Hebrew_Israel.1255; LC_CTYPE = Hebrew_Israel.1255; LC_MONETARY = Hebrew_Israel.1255; LC_NUMERIC = C; LC_TIME = Hebrew_Israel.1255”
Sys.setlocale(“LC_ALL”,“希伯来语”)
[1] “LC_COLLATE = Hebrew_Israel.1255; LC_CTYPE = Hebrew_Israel.1255; LC_MONETARY = Hebrew_Israel.1255; LC_NUMERIC = C; LC_TIME = Hebrew_Israel.1255”
H&lt; - “שלום” ħ
<强>&GT; [1]“ùìåí” #THEHEBE在希伯来语中
Sys.getlocale()
[1] = LC_COLLATE Hebrew_Israel.1255; LC_CTYPE = Hebrew_Israel.1255; LC_MONETARY = Hebrew_Israel.1255; LC_NUMERIC = C; LC_TIME = Hebrew_Israel.1255"
Sys.setlocale(“LC_ALL”,“ja”)
[1] “LC_COLLATE = Japanese_Japan.932; LC_CTYPE = Japanese_Japan.932; LC_MONETARY = Japanese_Japan.932; LC_NUMERIC = C; LC_TIME = Japanese_Japan.932”
<强>&GT; H&lt; - “שלום”#使用其他语言的解决方案 - 也见下文
ħ
[1]“שלום”
Sys.setlocale(“LC_ALL”,“Portuguese_Brazil.1252”)[1]“LC_COLLATE = Portuguese_Brazil.1252; LC_CTYPE = Portuguese_Brazil.1252; LC_MONETARY = Portuguese_Brazil.1252; LC_NUMERIC = C; LC_TIME = Portuguese_Brazil.1252”< / p>
H&lt; - “שלום”
ħ
[1]“שלום”
Sys.setlocale(“LC_ALL”,“German”)[1]“LC_COLLATE = German_Germany.1252; LC_CTYPE = German_Germany.1252; LC_MONETARY = German_Germany.1252; LC_NUMERIC = C; LC_TIME = German_Germany.1252”
H&lt; - “שלום”
ħ
[1]“שלום”