bug-ncurses
[Top][All Lists]
Advanced

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

Surrogate pairs for addwstr?


From: Bill Gray
Subject: Surrogate pairs for addwstr?
Date: Sat, 9 Oct 2021 13:41:57 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

   I tried feeding Unicode surrogate pairs to ncurses,  and
nothing shows up (two blank characters are shown in xterm where
one combined SMP character ought to.)  Test code is shown below.
When run with ncurses,  the second treble shows up;  the first one
doesn't.

   I encountered this while adding/testing surrogate pairs for
PDCursesMod;  the more extensive test code (which works in ncurses
except for this surrogate pair issue) is at

https://github.com/Bill-Gray/PDCursesMod/blob/master/demos/widetest.c

Thank you,        -- Bill

/* Compile with gcc -Wall -Wextra -o treble treble.c -lncursesw */

#define NCURSES_WIDECHAR 1
#define HAVE_NCURSESW
#define _XOPEN_SOURCE_EXTENDED 1

#include <stdlib.h>
#include <string.h>
#include <curses.h>
#include <locale.h>

int main( const int argc, const char *argv[])
{
    setlocale(LC_ALL, "");
    initscr();
    clear( );
    keypad( stdscr, 1);
    mvaddwstr( 0, 2, L"\xd83d\xdd1e Treble clef with a surrogate pair");
    mvaddwstr( 1, 2, L"\x1d11e Treble clef with U+1D11E");
    mvaddstr( 2, 2, "Hit any key");
    getch( );
    endwin( );
    return( 0);
}



reply via email to

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