From murdoch.duncan at gmail.com  Wed May 24 16:16:28 2017
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Wed, 24 May 2017 10:16:28 -0400
Subject: [Rd] reg-tests-1d.R fails in r72721
In-Reply-To: <20170524135943.aj6hod6r2droq3ie@godel.dcu.ie>
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>
 <20170524135943.aj6hod6r2droq3ie@godel.dcu.ie>
Message-ID: <6810b345-7d32-6668-e4fa-9c478b4c2600@gmail.com>

On 24/05/2017 9:59 AM, Hiroyuki Kawakatsu wrote:
> 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

Thanks.  I've made that test conditional on running on Windows, and 
re-opened bug 17120.  I indicated that it's now a Unix-only bug.

This may be a first:  a case where R handles non-native characters 
better in Windows than it does in Unix.  I'm sure this will show up in a 
Microsoft ad soon :-).

Duncan Murdoch

> 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.
>



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