Non English (Hebrew) output in RStudio console
Asked Answered
M

1

3

The following test works fine on my laptop, but produces an error on my HP EliteOne 800 running Windows 10

H <- "שלום"

H

In the machine with the problem I get

[1] "ùìåí"

I tested several encoding, such as

Encoding(H)  <- "ISO-8859-1"

which gives the same output, and

Encoding(H)<-"UTF-8"
H

that produces

[1] "\xf9\xec\xe5\xed"

Below is the response to

sessionInfo()

R version 3.2.2 (2015-08-14) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: 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

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

loaded via a namespace (and not attached): [1] tools_3.2.2

Any help will be appreciated,

Avi

Mix answered 10/12, 2015 at 19:11 Comment(2)
This might helpCapsicum
It appears you do not have the proper fonts installed to support that encoding. When I drop the first line of code into my Mac console it displays properly. My monospace font is "Courier". The information needed should be accessible with help(pac=grDevices)Trisa
M
4

Thank you Richard, you led me to a solution that works -- although I do not understand why. I played with various codes, and accidentally changed my locale to Japanese and it works. Than I tested various other locales and they do the same trick. If any one knows why the Hebrew does not work with Hebrew locale, I would like to know. Below is the code and its product:

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 <- "שלום"

H

> [1] "ùìåí" #THE PROBLEM IN HEBREW

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", "Hebrew")

[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 <- "שלום" H

> [1] "ùìåí" #THE PROBLEM IN HEBREW

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"

> H <- "שלום" #THE SOLUTION IN OTHER LANGUAGE THAT WORKS -- ALSO SEE BELOW

H

[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"

H <- "שלום"

H

[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 <- "שלום"

H

[1] "שלום"

Mix answered 12/12, 2015 at 13:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.