Hello,
Have a look at the function iconv, which converts a character vector
from one encoding to another.
If you're not interested in converting from one encoding to another,
and just want any character vector to be encoded as UTF-8, open the
file in the following way, passing encoding="UTF-8".
fd <- file("My File", "w", encoding="UTF-8")
I know this works under Mac OS X and on Linux. I don't see why it
shouldn't work on Windows too.
Wee-Jin
On 23 Nov 2006, at 11:45, ronggui wrote:
> Dear lister,
>
> I would like to now if there a universal way to writing a character
> vector to a file in UTF-8 encoding? By " universal", I mean a way
> which works under Linux, Windows and Mac.
>
> Thanks in advance!
>
> --
> Ronggui Huang
> Department of Sociology
> Fudan University, Shanghai, China
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.