[R] FW: R encoding question

Gabor Grothendieck ggrothendieck at gmail.com
Tue Nov 30 15:25:47 CET 2010


On Tue, Nov 30, 2010 at 9:09 AM, Xiaobo Gu <guxiaobo1982 at gmail.com> wrote:
> But locale "Chinese" will use GBK encoding by default, how to use UTF-8
> encoding
>
> I have tried the following, neither of them works.
>
> Sys.setlocale(locale = "zh_CN.UTF-8")
>
> Sys.setlocale(category = "LC_CTYPE", locale= "zh_CN.UTF-8")
>
>

Try this:

> Sys.setlocale(locale = "Chinese_China")
[1] "LC_COLLATE=Chinese (Simplified)_People's Republic of
China.936;LC_CTYPE=Chinese (Simplified)_People's Republic of
China.936;LC_MONETARY=Chinese (Simplified)_People's Republic of
China.936;LC_NUMERIC=C;LC_TIME=Chinese (Simplified)_People's Republic
of China.936"

Although it does not specifically indicate UTF in the output if we now
search for Chinese_China.936 we do find the link below which suggests
that it is a UTF locale:

http://docs.moodle.org/en/Table_of_locales






-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list