Message-ID: <20170524135943.aj6hod6r2droq3ie@godel.dcu.ie>
Date: 2017-05-24T13:59:43Z
From: Hiroyuki Kawakatsu
Subject: reg-tests-1d.R fails in r72721
In-Reply-To: <c50ef3bc-3bfe-4afe-416f-ae60346073a2@gmail.com>
On 2017-05-24, Duncan Murdoch wrote:
[...]
> Okay, how about if we weaken the test?
[...]
> try
>
> stopifnot(path.expand(paste0("~/", filename)) ==
> paste0(path.expand("~/"), filename))
>
Nope:
> ## path.expand shouldn't translate to local encoding PR#17120
> filename <- "\U9b3c.R"
>
> #stopifnot(identical(path.expand(paste0("~/", filename)),
> stopifnot(path.expand(paste0("~/", filename)) ==
+ paste0(path.expand("~/"), filename))
Error: path.expand(paste0("~/", filename)) == paste0(path.expand("~/"), .... is not TRUE
Execution halted
The problem is that path.expand(), or do_pathexpand() for
non-windoze calls translateChar() which in turn calls
translateToNative() which is unknown to make check (but not to R
--vanilla) under my setup. Once it is unknown, there seems to be no
way to force an encoding:
> ## path.expand shouldn't translate to local encoding PR#17120
> filename <- "\U9b3c.R"
> print(Encoding(filename))
[1] "UTF-8"
>
> y1 <- paste0("~/", filename)
> print(Encoding(y1))
[1] "UTF-8"
>
> y2 <- path.expand(y1)
> print(Encoding(y2))
[1] "unknown"
>
> y3a <- iconv(y2, to="UTF-8")
> print(Encoding(y3a))
[1] "unknown"
>
> y3b <- enc2utf8(y2)
> print(Encoding(y3b))
[1] "unknown"
>
> Encoding(y2) <- "UTF-8"
> print(Encoding(y2))
[1] "unknown"
>
h.
--
+---
| Hiroyuki Kawakatsu
| Business School, Dublin City University
| Dublin 9, Ireland. Tel +353 (0)1 700 7496