简体   繁体   中英

in R, data.frame() or write.csv2() functions, change the encoding

I have a text in Persian:
tabs <- "سرگرمی"
and I need to have it in dataframe.
when I try:
final <- data.frame(tabs)

I get this:

在此处输入图像描述

exporting the text to.csv using write.csv2(), gives me the same problem too.

any idea how to have the text as original encoding?

We can set the locale with Sys.setlocale

Sys.setlocale("LC_ALL","Persian") 

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