做中文文本挖掘的时候经常要读取中文网站上的信息,但英文系统RStudio在WINDOWS系统下有无法完全兼容中文字符,所以print到显示器上的中文字符统统是乱码。处理方法如下:
首先修改系统语言:
Control Panel -> Region and Language -> Formats -> Chinese (Simplified, PRC)
Control Panel -> Region and Language -> Administrative -> Change System Locale... -> Chinese (Simplified, PRC)
修改完了以后,可以用`sessionInfo()`在RStudio中查看系统设置:
sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
attached base packages: