file io - write.csv strange encoding in R -
i encountering strange problem not able resolve myself.
suddenly, write.csv encoding csv file in way make impossible read in libre office. command has worked until today. now, if try use write.csv (or more general equivalent write.table) , try open file libre office, bunch of symbol , asian character. don't understand what's happening here, seems default encoding of write.csv has changed itself. different thing done today reading text file encoded using program eprime, , had use following command in order read file
a=read.delim("pre_newtask_run1.txt", fileencoding="ucs-2le")
is possible has changed default encoding of write.csv ? , if case, how can change ?
thanks in advance help
it may difficult provide precise answer without sample data or reproducible code being made available. having said that, initial attempt can attempt force export of data use of specific encoding example, code:
con<-file('filename',encoding="utf8") write.csv(...,file=con,...)
would enable use utf-8 encoding. may run l10n_info()
command provide information on local encoding have:
> l10n_info() $mbcs [1] false $`utf-8` [1] false $`latin-1` [1] true $codepage [1] 1252
Comments
Post a Comment