[R] [SOLVED] file reading /problems with encoding
T.Wunder at stud.uni-heidelberg.de
T.Wunder at stud.uni-heidelberg.de
Wed Mar 3 09:44:47 CET 2010
After 1 day searching the internet, I solved the problem with the
following code:
> Encode(xml) <- "UTF-8"
> # now the ü etc. become ü,etc.
> gsub("ü","Ä",xml) # employ the gsub()-function WITHOUT
> useBytes-option turned on
> Encode(xml) <- "unknwon"
> # that was the former encoding
So all in all there is a way of re-encode a character-string to UTF-8,
the Encode() function. The above produces a valid xml-string and - if
I sink it out - a valid xml-file.
Thanks for your help!
Greetings,
Tom
Quoting Uwe Ligges <ligges at statistik.tu-dortmund.de>:
> R is not able to re-encode the file to the native encoding. But if you
> keep it in UTF-8, what is the problem to grep for the specific
> characters (as grep and friends support the argument useBytes these
> days)?
>
> Best,
> Uwe Ligges
>
More information about the R-help
mailing list