On Fri, Sep 26, 2008 at 03:26:59PM +0200, Juan Cespedes wrote:
> Package: libncursesw5,libncursesw5-dev
> Version: 5.6+20080830-1
> Severity: normal
> 
> When using multi-bytes UTF-8 characters in libncurses, it wrongly
> calculates its width, and messes up all the display.
> 
> Attached is a simple program which demostrates it; the output should be:

Two observations:

It does not initialize locale.

  #include <locale.h>
> #include <ncursesw/ncurses.h>
> 
> int main(void)
> {
        setlocale(LC_ALL, "");
>       initscr();
>       curs_set(0);
> 
>       mvaddch(0, 0, '+');
>       mvaddch(0, 15, '+');
>       mvaddch(3, 0, '+');
>       mvaddch(3, 15, '+');
>       mvhline(0, 1, '-', 14);
>       mvhline(3, 1, '-', 14);
>       mvvline(1, 0, '|', 2);
>       mvvline(1, 15, '|', 2);
> 
>       mvaddstr(1, 1, "Juan Cespedes");
>       mvaddstr(2, 1, "Juan Céspedes");

The string is encoded for ISO-8859-1 (not UTF-8).

>       refresh();
>       getch();
>       endwin();
>       return 0;
> }


-- 
Thomas E. Dickey <[EMAIL PROTECTED]>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature

Reply via email to