[R] Writing escaped unicode

David Kulp dkulp at fiksu.com
Tue Dec 11 05:46:40 CET 2012


I'd like to write unicode strings using the "\u" escape syntax.  According to the documentation, print.default or encodeString will escape unicode using the \u convention.  In practice, I can't make it work.

> b="Unicode character: \ufffd"
> print.default(b)
[1] "Unicode character: �"
> encodeString(b)
[1] "Unicode character: �"

I want to write the string back out in the same escape formatting as I read it in.  This is because I'm interfacing with some Ruby code that requires unicode to be in this escaped format.

Thanks in advance!



More information about the R-help mailing list