[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ncurses-5.7-20090530.patch.gz

From: Clemens Ladisch
Subject: Re: ncurses-5.7-20090530.patch.gz
Date: Wed, 03 Jun 2009 15:59:10 +0200
User-agent: Thunderbird (Windows/20090302)

Thomas Dickey wrote:
> On Wed, 3 Jun 2009, Clemens Ladisch wrote:
>> Thomas Dickey wrote:
>>> On Wed, 3 Jun 2009, Clemens Ladisch wrote:
>>>> I don't quite understand your last sentence.  As far as I understand
>>>> the curses specification, ncurses should _never_ stop using the legacy
>>>> encoding because any locale could use an encoding that has non-printable
>>>> characters above 127.  For example, UTF-8 uses the bytes 128..253 for
>>>> multi-byte sequences, so none of these are printable.
>>> Not exactly.  If the locale is unset, technically only POSIX (0-127) is
>>> recommended.  However, since 1997 (before locale support on Linux was
>>> anything but vaporware), ncurses has interpreted that case as ISO-8859-1
>>> (hence "legacy").
>> So this is why unctrl() calls iswprint()?
> yes... It should only be _calling_ iswprint if there is a locale set:

But iswprint() is not affected by the locale.

>                  if ((check >= 160)
>                   && (check < 256)
>                   && ((sp != 0)
>                    && ((sp->_legacy_coding > 0)
>                         ^^^ (this is true if there's no locale set, so
>                           evaluation of the expression stops here)

Okay; I misunderstood your description of legacy encoding to apply for
the case sp->_legacy_coding==0, too.

>                     || (sp->_legacy_coding == 0
>                         && (isprint(check) || iswprint(check))))))

But here is still a bug: iswprint() must not be called for single-byte
characters because that function assumes its parameter is a wide
character, and wide characters are Unicode, which is the same as
ISO 8859-1 for 8-bit values.  This gives wrong values for locales with
any other encoding.

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]