On 2020-05-05 15:12 +0430, Mehdi Dadkhah wrote:
> I have a CSV file which its encoding is 
> ANSI. How can i change its encoding to 
> UTF-8 in R?

Hi!

I do not know about ANSI, but to read latin1 
encoded csv files into readr, do this:

Determine that your file is latin1-encoded:

        rasmus@twentyfive ~ % file -i SAA.csv
        SAA.csv: application/csv; charset=iso-8859-1

read it in using readr::read_csv

        locale <- readr::locale(encoding = "latin1")
        SAA <- suppressMessages(
          readr::read_csv(file="SAA.csv",
                          locale=locale))

Best,
Rasmus

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to