Using Hebrew characters in string
Asked Answered
A

1

2

I would like to use Hebrew characters in string in R. I used the following:

> a<-c("משה")
> a
[1] "îùä"
> class (a)
[1] "character"

As can be seen I get Jibbrish when I output the content of the string or using any functions. How can I use Hebrew characters?

Audile answered 13/10, 2015 at 16:56 Comment(5)
Works perfectly fine for me. Are you on Windows? If so, my condolences — it may not be easy to achieve this.Heraclitean
> a<-c("משה") > a [1] "משה" > sessionInfo() R version 3.2.2 (2015-08-14) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.11 (El Capitan) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8Hemispheroid
@Shawn Mehan, I use Windows. Here is my sessioninfo(): > sessionInfo() R version 3.2.1 Patched (2015-07-16 r68681) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 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.1255Audile
Did you get any joy with Richard's suggestion of Encoding. You can man it in RStudio via > ?EncodingHemispheroid
I would like to use Hebrew freely with English. Without any need to encode every time I use Hebrew.Audile
A
3

Thanks to all the comments here is the answer: If I use it as is, I get Jibbrish:

> a<-"משה"
> a
[1] "îùä"

However if I encode it to UTF8 I get the right result:

> a<-enc2utf8( "משה")
> a
[1] "משה"

I wish there was a way to do it without encoding.

Audile answered 25/10, 2015 at 5:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.