From hkawakat at gmail.com  Wed May 24 15:59:43 2017
From: hkawakat at gmail.com (Hiroyuki Kawakatsu)
Date: Wed, 24 May 2017 14:59:43 +0100
Subject: [Rd] reg-tests-1d.R fails in r72721
In-Reply-To: <c50ef3bc-3bfe-4afe-416f-ae60346073a2@gmail.com>
References: <20170524094728.ynpyldncoeipp3bq@godel.dcu.ie>
 <cd5731cf-69ee-10da-1f76-9b671e77584c@gmail.com>
 <20170524115900.xuxydwfoxdacq74b@godel.dcu.ie>
 <c50ef3bc-3bfe-4afe-416f-ae60346073a2@gmail.com>
Message-ID: <20170524135943.aj6hod6r2droq3ie@godel.dcu.ie>

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



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