Skip to content
Prev 27120 / 63461 Next

encoding question again

Matthias,

you get exactly what you specified - namely UTF-8. If you want your  
html file to be latin1, then you have to say so:

zz = file( paste("Itemtabelle/Itemtabelle", abt, ".html"), "wt",  
encoding = "latin1")

In addition, you're assuming that `abt' is in the correct encoding to  
be understood by your OS. If it's not, you better convert it into one.  
 From your results it seems as if `abt' is also UTF-8 encoded. Since  
you didn't tell us where you got that from, you should either fix the  
source or use something like iconv(abt,"utf-8","latin1"):

(in UTF-8 locale)
 > abt="n?r"
 > cat(abt,"\n")
n?r
 > charToRaw(abt)
[1] 6e c3 bc 72
 > charToRaw(iconv(abt,"utf-8","latin1"))
[1] 6e fc 72

Cheers,
Simon
On Dec 27, 2007, at 3:11 PM, Matthias Wendel wrote: