简体   繁体   English

我可以将从Web下载的非UTF-8编码的CSV文件转换为Rstudio中的UTF-8编码吗?

[英]Can I convert non UTF-8 encoding CSV file downloading from web into UTF-8 encoding in Rstudio?

I want to import a CSV file from web. 我想从网络导入CSV文件。 The CSV file is an EUC-KR encoding file, and there are some Korean characters in the CSV file. CSV文件是EUC-KR编码文件,并且CSV文件中有一些韩文字符。

When I tried this: 当我尝试这个:

x <- "www.google.com/abcdefg.csv"
read.csv(x, header=T)

I got this error message: 我收到此错误消息:

Error in make.names(col.names, unique = True) :
 invalid multibyte string at '<b3><af>¥

I know that I can convert the CSV file with Text Editor like Notepad++. 我知道我可以使用文本编辑器(如Notepad ++)转换CSV文件。

But I want to import some non UTF-8 encoding data from web in Rstudio not using the Text Editor. 但是我想不使用文本编辑器从Rstudio中的Web导入一些非UTF-8编码数据。

I also tried this: 我也试过这个:

x <- "www.google.com/abcdefg.csv"
read.csv(x, header=T,encoding="UTF-8")

but I still got the same error message. 但我仍然收到相同的错误消息。 Do you know how to do this? 你知道怎么做吗?

When reading the csv, you should state the encoding of the input. 读取csv时,应声明输入的编码。 So try replacing UTF-8 with the encoding of your file. 因此,请尝试使用文件编码替换UTF-8。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM