How to export csv in utf-8 format?

I am trying to export data.frame to csv using utf-8 encoding. I tried to create a file with write.csv without success, and help (write.csv) did not mention any specific tips for creating this specific result. Here is my current export line.

write.csv(prod_out, file="product_output.csv",append=FALSE,eol="\r") 

Any advice you can offer is appreciated.

+6
r
source share
2 answers

Try opening a UTF8 connection:

 con<-file('filename',encoding="UTF-8") write.csv(...,file=con,...) 
+13
source share

This question is quite old - I think that since 2010 the situation has changed a lot. Anyway, I just ran into this post and I found out about this solution. You simply add the fileEncoding = "UTF-8" option directly to write.csv .

+10
source share

All Articles