[R-SIG-Mac] problem with character encoding in file names in R 3.2

Denis Chabot chabot.denis at gmail.com
Sun May 3 21:11:27 CEST 2015


Hi,

I don’t quite know how to produce a repeatable example for you because the problem I have seems to be caused by folder names on my computer.

Yesterday I was still using R 3.1.2 and there was no problem with this issue. 

Today with R3.2 it does not.

Input = "../data/"
juvcodData = paste0(Input, "Données respirométrie SDA morues juv/« )  # the name of this folder contains accented vowels

a = 1:10folder1 = paste0(Input, "Données respirométrie SDA morues juv/")
folder2 = paste0(Input, "Donnees respirometrie SDA morues juv/")

a = 1:10
save(a, file="bé.Rda ») #1
save(a, file=paste(Input, "bé.Rda »)) #2
save(a, file=paste(folder1, "bé.Rda »)) #3
save(a, file=paste(folder1, "be.Rda »)) #4
save(a, file=paste(folder2, "bé.Rda »)) #5
save(a, file=paste(folder2, "be.Rda »)) #6


All files were saved with the name I expected, except for # 3: 
bé (Conflit lié au codage Unicode).Rda
with the bracket loosely translating to « Conflict related/caused(?) to Unicode coding » 

So if there is an accented vowel somewhere along the path already defined in R, and the name I want to give the file, the file name is so altered. If the is an accent only in one of the two, no problem. As I said, there was no such problem with R 3.1.2.

The problem is probably not due to R itself, as this works:
> paste0(folder1, "bé.Rda")
[1] "../data/Données respirométrie SDA morues juv/bé.Rda »

But when R uses this string as a path name when saving a file, I get the problem above.

Thanks for any help or suggestion,

Denis

> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)

locale:
[1] fr_CA.UTF-8/fr_CA.UTF-8/fr_CA.UTF-8/C/fr_CA.UTF-8/fr_CA.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.2.0



More information about the R-SIG-Mac mailing list