# locale problem# 2018.3.14Sys.getlocale()rm(list=ls())a1 <- "線"a1write.csv(a1, file = "MyData1.csv")
Sys.setlocale("LC_ALL", "C")Sys.getlocale()a2 <- "線"a2write.csv(a2, file = "MyData2.csv")
# method 1 修改 localeSys.setlocale(category = "LC_ALL", "Chinese (Traditional)_Taiwan.950")Sys.getlocale()a3 <- "線"a3write.csv(a3, file = "MyData3.csv")
# method 2 使用 iconvSys.setlocale("LC_ALL", "C")Sys.getlocale()a4 <- "線"a4a4 <- iconv(a4, "UTF-8", "BIG-5")a4write.csv(a4, file = "MyData4.csv")# endrm(list=ls())
Sys.getlocale()
Sys.setlocale(category="LC_ALL","Chinese (Traditional)_Hong Kong S.A.R..950")
a1 <- "綫"
a1
write.csv(a1, file = "MyData1.csv")
a2 <- "綫"
a2
a2 <- iconv(a2,"UTF-8","BIG-5")
a2
write.csv(a2, file = "MyData2.csv")
a3 <- "線"
a3
write.csv(a3, file = "MyData3.csv")