我们正在收集音乐家数据,其中包含外国字符(西班牙语,中文,韩语等)的音乐家名称。我想我必须指定编码,我陷入困境。以下是我的临时解决方案,适用于英语+西班牙语名称。
#if I don't specify encoding = "Latin-1", they will not display any foreign names correctly.
#By setting encoding = "Latin-1", it makes sure Spanish names display correctly.
#However, it doesn't work for Asian characters.
dd = fread(paste0("/shiny-server/testingfile.csv"), encoding = "Latin-1")
#to download it and show names correctly, I also need to set fileEncoding = "latin1"
output$map = downloadHandler(
filename = function(){
paste("Mapping Request ",Sys.time(),".csv",sep="")
},
content = function(file){
write.csv(data,file,row.names = F,fileEncoding = "latin1")
}
)
我想知道有没有办法让任何外国名字正确显示?或者我必须为每种语言设置编码(这是不实际的)。当我设置encoding =" UTF-8"时,它只能正确显示英文名称。
顺便说一句,我们的Shiny-server是Linux。
提前谢谢你。