0

Initial csv file is having Thai Language in some columns, i have queried the data from SQL server and save as csv-utf8 format, so csv itself having thai language, while loading in r, Successfully read the data in Thai in R, after cleaning the data, is it possible to store the Thai in csv

In First R Script I set the environment and read the csv. After Data Cleaning, tried writing csv in the R Scripts shown below, but the result csv is not having Thai instead having other characters

Sys.setlocale(locale="Thai")
data <- read.csv("data.csv",encoding = "UTF-8")
write.csv(data,"data.csv",fileEncoding = "UTF-8")
encodeConnection <- file('data.csv', encoding = "UTF-8")
write.csv(data, file = encodeConnection)
readr::write_csv(data,"data.csv")
data.table::fwrite(data,"data.csv")

I expect csv with Thai, but having "บัตรประชาชน"

hanzgs
  • 1,498
  • 17
  • 44

0 Answers0