Skip to content
Prev 8290 / 15076 Next

accented vowels

Le 2011-08-15 ? 19:06, Duncan Murdoch a ?crit :
Hi Duncan, 

iconv() confirmed what I suspected: there was no problem with the encoding of the result of list.files, and if there had been one, the "?" would not have looked like a "?". Therefore, I got nonsense when treating this "?" as MacRoman to be converted into UTF-8:

iconv(b, from="MacRoman", to="UTF-8")
[1] "1_MO2 crevettes po2crit.Rda" "1_MO2 soles Se??te sda.Rda"  "1_MO2 turbots po2crit.Rda"  

It is not clear however that R considered b to be UTF=8:
Encoding(b)
[1] "unknown" "unknown" "unknown"

so I followed your suggestion:

Encoding(b) <- "UTF-8"
Encoding(b)
[1] "unknown" "UTF-8"   "unknown"

but gsub still did not work:
b2 = gsub(" S?te", "S",  b); b2  
[1] "1_MO2 crevettes po2crit.Rda" "1_MO2 soles S?te sda.Rda"     "1_MO2 turbots po2crit.Rda"  

I do not know why gsub worked with example "a" but not "b" in the example shown in my original message. Strange and frustrating.

Denis