Warning in set locale

I work with a dataset that's in Japanese. I got the following warning message
"Warning message:
In Sys.setlocale(category = "LC_ALL", locale = "Japanese") :
OS reports request to set locale to "Japanese" cannot be honored"

when I try to set locale to Japanese language, using "Sys.setlocale(category = "LC_ALL", locale = "Japanese")".

> Sys.setlocale(category = "LC_ALL", locale = "Japanese")
[1] ""
Warning message:
In Sys.setlocale(category = "LC_ALL", locale = "Japanese") :
  OS reports request to set locale to "Japanese" cannot be honored

Additionally, when I open my R script file, which has some Japanese characters inside, then those characters become something like "$B%3IU(B", but when I open a dataset in Japanese (in .csv) by read_csv, it can display normally.

Could anyone help with this ?

Thank you so much

RStudio Cloud runs on Linux based virtual machines. The locales available are all UTF-8 based:

Try setting your locale to: ja_JP.UTF-8:

> Sys.setlocale("LC_ALL", "ja_JP.UTF8")
[1] "LC_CTYPE=ja_JP.UTF8;LC_NUMERIC=C;LC_TIME=ja_JP.UTF8;LC_COLLATE=ja_JP.UTF8;LC_MONETARY=ja_JP.UTF8;LC_MESSAGES=C.UTF-8;LC_PAPER=C.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C.UTF-8;LC_IDENTIFICATION=C"

Additionally, you should make sure that your source and data files are UTF-8 encoded so they can rendered by the IDE.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.