[Rd] reg-tests-1d.R fails in r72721

Hiroyuki Kawakatsu hkawakat at gmail.com
Wed May 24 15:59:43 CEST 2017


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



More information about the R-devel mailing list