R does not display Arabic text correctly. I get very strange things when I use Arabic. Here is a screenshot:

The problem is that I want to create a wordcloud with Arabic text, and first I need to solve this problem.
R version: R 2.15.2 GUI 1.53 Leopard build 64-bit (6335)
More details:
> options("encoding") $encoding [1] "native.enc" > Encoding("الله") [1] "unknown"
SessionInfo ():
> sessionInfo() R version 2.15.2 (2012-10-26) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] C/C/C/C/de_DE/C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.15.2 >
Some processing:
> x = "مرحبا" > Encoding(x) = "UTF-8" > x [1] "<U+0645><U+0631><U+062D><U+0628><U+0627>" > Encoding(iconv(x)) [1] "unknown"
Additional Information:
> Sys.getlocale() [1] "C/C/C/C/de_DE/C" > Sys.setlocale("LC_ALL", "en_US.utf8") [1] "" Warning message: In Sys.setlocale("LC_ALL", "en_US.utf8") : OS reports request to set locale to "en_US.utf8" cannot be honored >
This solved the problem:
Sys.setlocale("LC_ALL", "en_US.UTF-8")
source share