On 24/05/2017 5:47 AM, Hiroyuki Kawakatsu wrote:
Hi,
I am failing make check in r72721 at the end of reg-tests-1d.R. The
relevant block of code is
## path.expand shouldn't translate to local encoding PR#17120
filename <- "\U9b3c.R"
print(Encoding(filename))
x1 <- path.expand(paste0("~/", filename))
print(Encoding(x1))
x2 <- paste0(path.expand("~/"), filename)
print(Encoding(x2))
stopifnot(identical( path.expand(paste0("~/", filename)),
paste0(path.expand("~/"), filename)))
## Chinese character was changed to hex code
Encoding(x1) is "unknown" while Encoding(x2) is "UTF-8". If I run
this code with R --vanilla, both are UTF-8 and the assertion
passes. What is make check doing differently? Or is there something
wrong with my setting/environment? Thanks,
I think the test is wrong because in the first case you are working in a
locale where that character is representable. In my locale it is not,
so x1 is converted to UTF-8, and everything compares equal.
An explicit conversion of x1 to UTF-8 should fix this, i.e. replace
x1 <- path.expand(paste0("~/", filename))
with
x1 <- enc2utf8(path.expand(paste0("~/", filename)))
Could you try this and see if it helps?
Duncan Murdoch
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel