Dear R Helpers, See the Code:
a <- intToUtf8(1777) show(a) zz <- file(description="test.txt",open="w",encoding="UTF-8") cat(a, file = zz) close(zz) in a Unicode aware environment (such as RGui console or RStudio Console) you will see this as output: [1] "Û±" but the character is not written correctly in the file test.txt (which is encoded in UTF-8 without BOM) : <U+06F1> The problem seems to be this: R changes text to the locale of system (for me this is Arabic Windows (Codepage 1256) that does not have a relevant code for U+06F1, then changes it back to UTF-8 and writes it into file. What do I miss here? How can I write a Unicode string into a text file correctly? Majid Einian, Economics Researcher, Monetary and Banking Research Institute, Central Bank of Islamic Republic of Iran, Tehran, IRAN and PhD Candidate in "Economics", Graduate School of Management and Economics, Sharif University of Technology, Tehran, IRAN [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list 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.