[Top][All Lists]

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

Re: Bugs in wide character API

From: Thomas Dickey
Subject: Re: Bugs in wide character API
Date: Sun, 22 Aug 2004 18:56:17 -0400 (EDT)

On Mon, 23 Aug 2004, Marcin 'Qrczak' Kowalczyk wrote:

> Hello. I found the following bugs (31 July snapshot):
> 1. add_wch ignores attributes and colors of the cchar.

that sounds like a bug.

> 2. get_wch doesn't recode a printing character from the locale encoding
>    to Unicode if the locale is different from UTF-8 (or ISO-8859-1 when
>    no recoding is needed).

I'm not sure why:  ncurses doesn't use any logic specific to UTF-8 for
that function.  (There is some specific logic for line-drawing characters,
which is a different topic).

> 3. get_wstr and friends take wint_t * instead of wchar_t * as their
>    parameter. X/Open specification seems to have a bug: it shows
>    wint_t * in one place (a page with get_wstr), but wchar_t * in
>    another (a page with the whole family). wchar_t * is the only type
>    which makes sense.

yes - X/Open spec has more than one error (starting with the compiler
warnings running on the machine-readable text).   I also compared with
implementations (of the same spec), for example Tru64.  They have win_t*.

At the moment I can't really see why the get_wstr should have used win_t*,
since (unlike get_wch) the result shouldn't have to represent negative
values.  Assuming there's no good reason, there's still portability of
applications - and I don't see any good reason to make programs that
can't port to Tru64 curses.  If the types are the same size, then an
(admittedly annoying) cast is all that's needed.

> (I made an interface to ncurses from my language Kogut. It uses wide
> character API if available, narrow character API otherwise. Kogut uses
> Unicode internally, so wide character API is important not only for
> UTF-8 terminals.)
> --
>    __("<         Marcin Kowalczyk
>    \__/       address@hidden
>     ^^     http://qrnik.knm.org.pl/~qrczak/
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-ncurses

Thomas E. Dickey

reply via email to

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