pkgsrc-Bugs archive

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

pkg/51671: ncursesw: Problems with displaying wide chars



>Number:         51671
>Category:       pkg
>Synopsis:       ncursesw: Problems with displaying wide chars
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 29 10:05:00 +0000 2016
>Originator:     Carsten Kunze
>Release:        NetBSD 7.99.42 (GENERIC.201611250700Z) amd64
>Organization:
>Environment:
NetBSD 7.99.42 (GENERIC.201611250700Z) amd64
>Description:
ncursesw function add_wchstr() has no useful output for wide characters. printw() does print some characters correct, some wrong. Both functions work correct with NetBSD curses (at least when compiled with ASAN) and with ncursesw on any other UNIX.
>How-To-Repeat:
locale is:

$ locale
LANG=""
LC_CTYPE="en_US.UTF-8"
LC_COLLATE="C"
LC_TIME="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

Below is a Makefile and a C file to reproduce the problem:

$ cat Makefile
INCDIR=         -I/usr/pkg/include
LIBDIR=         -L/usr/pkg/lib
RPATH=          -Wl,-rpath,/usr/pkg/lib
LDADD=          -lncursesw

main: main.o
        $(CC) $(RPATH) $(LIBDIR) -fsanitize=address main.o -o $@ $(LDADD)

clean:
        rm -f main.o main

.c.o:
        $(CC) -c $(CFLAGS) -DNCURSESW $(INCDIR) -fsanitize=address $<

$ cat main.c                                                                                                                                                                                   
#define _XOPEN_SOURCE_EXTENDED
#include <locale.h>
#include <stdlib.h>
#ifdef NCURSESW
# include <ncursesw/curses.h>
#else
# include <curses.h>
#endif

int
main()
{
        static wchar_t ws[2];
        wchar_t wcs[100];
        cchar_t ccs[100];
        wchar_t *wcp;
        cchar_t *ccp;
        char *mbs = "äöüß";

        setlocale(LC_ALL, "");
        initscr();

        printw("%s\n", mbs);

        mbstowcs(wcs, mbs, sizeof(wcs)/sizeof(*wcs));

        wcp = wcs;
        ccp = ccs;

        do {
                *ws = *wcp++;
                setcchar(ccp++, ws, 0, 0, NULL);
        } while (*ws);

        add_wchnstr(ccs, -1);

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

>Fix:


Home | Main Index | Thread Index | Old Index