Re: Cygwin fails to utilize Unicode replacement character
- Date: Tue, 4 Sep 2018 13:59:10 -0600
- From: Doug Henderson <djndnbvg@xxxxxxxxx>
- Subject: Re: Cygwin fails to utilize Unicode replacement character
On Sat, 1 Sep 2018 at 10:13, Steven Penny wrote:
> You get this result with Linux:
> $ cat alfa.txt
> Where "cat" properly outputs Unicode 'REPLACEMENT CHARACTER' (U+FFFD). However
> with Cygwin you get this:
> $ cat alfa.txt
> Where "cat" outputs Unicode Character 'MEDIUM SHADE' (U+2592).
My preference is to remove the output fiddling code that Corrina has
been working on. It is trying to solve the wrong problem.
I think we have gone down a rabbit hole at the wrong end of cat's data flow.
Should any changes to the way a character is displayed be required, it
needs to be in the terminal program that display the character, not in
cygwin which should pass the character along unmodified.
Both cygwin and Debian 9.5 show:
$ file alfa.txt
alfa.txt: ISO-8859 text
When Linux reads the file, it assumes the encoding is UTF-8.
When cygwin reads the file, it assume the encoding is CP1252
This command shows the problem
$ iconv -f utf8 alfa.txt
iconv: alfa.txt:1:0: incomplete character or shift sequence
On Linux, this shows a slightly different message, with the same intent.
Try using this string:
$ printf "\xC3\xAB\353\n"
to get a better understanding of the problem. It contains two
representation of LATIN SMALL LETTER E WITH DIAERESIS, first encoded
in UTF-8, then using ISO-8859-1.
There are two different reasons for the MEDIUM SHADE. Here it
indicates an invalid UTF-8 character, and the font does not have a
glyph for REPLACEMENT CHARACTER. The MEDIUM SHADE is also used in
place of an ordinary character without a glyph in the font.
Doug Henderson, Calgary, Alberta, Canada - from gmail.com
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple