bug-ncurses
[Top][All Lists]
Advanced

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

Re: Surrogate pairs for addwstr?


From: Thomas Dickey
Subject: Re: Surrogate pairs for addwstr?
Date: Sat, 9 Oct 2021 16:28:00 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Sat, Oct 09, 2021 at 01:41:57PM -0400, Bill Gray wrote:
>    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.

yes... surrogate pairs are neglected because they're not used on Unix-alike
platforms - only with Windows (or Java).  I'm aware that there's a gap with
the MingW port (but MinGW locale support has other problems, ditto for
font support in console windows).

Some of the comments here seem relevant:

https://buildmedia.readthedocs.org/media/pdf/unicodebook/latest/unicodebook.pdf
 
>    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);
> }
> 

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

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