From murdoch.duncan at gmail.com  Wed May 24 13:06:28 2017
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Wed, 24 May 2017 07:06:28 -0400
Subject: [Rd] reg-tests-1d.R fails in r72721
In-Reply-To: <20170524094728.ynpyldncoeipp3bq@godel.dcu.ie>
References: <20170524094728.ynpyldncoeipp3bq@godel.dcu.ie>
Message-ID: <cd5731cf-69ee-10da-1f76-9b671e77584c@gmail.com>

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



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