简体   繁体   中英

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. The CSV file is an EUC-KR encoding file, and there are some Korean characters in the CSV file.

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++.

But I want to import some non UTF-8 encoding data from web in Rstudio not using the Text Editor.

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. So try replacing UTF-8 with the encoding of your file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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