From possenriede at gmail.com  Tue Aug  1 12:33:47 2017
From: possenriede at gmail.com (Daniel Possenriede)
Date: Tue, 1 Aug 2017 12:33:47 +0200
Subject: [Rd] special latin1 do not print as glyphs in current devel on
	windows
In-Reply-To: <CANu2KkP9jocnj4sa=mDtP4NOiw-VuJwi0WjMF1C28=2RADepdQ@mail.gmail.com>
References: <CANu2KkMwkC3zOkrc7ijc4D2qdhkdacaxjNnqN2XUxhnBn8rRDw@mail.gmail.com>
 <CANu2KkP9jocnj4sa=mDtP4NOiw-VuJwi0WjMF1C28=2RADepdQ@mail.gmail.com>
Message-ID: <CANu2KkPw00EzXWJKN4ZKP4fpY7H2JzveSZ9OekFM3F5uBAtTvQ@mail.gmail.com>

Sorry, I should have included my console output, obviously. So here we go:

Wrong UTF-8 escapes with using print in v3.5.0 devel:

# R Under development (unstable) (2017-07-30 r73000) -- "Unsuffered
Consequences"
# Platform: x86_64-w64-mingw32/x64 (64-bit)

> x <- c("?", "?", "?")
> Encoding(x)
[1] "latin1" "latin1" "latin1"
> print(x)
[1] "\u0080" "\u0096" "\u0089"

Same output with enc2utf8()

> enc2utf8(x)
[1] "\u0080" "\u0096" "\u0089"

With iconv() the result is as expected.

> iconv(x, to = "UTF-8")
[1] "?" "?" "?"

The second problem IMO is that encoding markers get lost with the enc2*
functions

> x_utf8 <- enc2utf8(x)
> Encoding(x_utf8)
[1] "UTF-8" "UTF-8" "UTF-8"
> x_nat <- enc2native(x_utf8)
> Encoding(x_nat)
[1] "unknown" "unknown" "unknown"

This is not the case with iconv()

> x_iutf8 <- iconv(x, to = "UTF-8")
> Encoding(x_iutf8)
[1] "UTF-8" "UTF-8" "UTF-8"
> x_inat <- iconv(x_iutf8, from = "UTF-8")
> Encoding(x_inat)
[1] "latin1" "latin1" "latin1"

	[[alternative HTML version deleted]]



[Rd] special latin1 do not print as glyphs in current devel on windows
Daniel Possenriede