bug-ncurses
[Top][All Lists]
Advanced

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

Re: bug report about addstr with cjk characters


From: Thomas Dickey
Subject: Re: bug report about addstr with cjk characters
Date: Sun, 20 Mar 2005 09:55:55 -0500
User-agent: Mutt/1.5.6+20040907i

On Sun, Mar 20, 2005 at 09:15:36PM +0800, WANG WenRui wrote:
> Hi,
> 
>   I found this problem when I was reading a letter from a traditional
>   Chinese user with mutt, which is built with ncursesw 5.4. Most
>   traditional Chinese characters is unreadable. At last I am sure that
>   the problem comes with perhaps a bug in ncurses. 
> 
>   My locale is GBK, under which the characters of Traditional Chinese
>   is coded between 128 - 160, so, when "addstr" a string of them, they
>   are "unctrl"ed in waddch_nosync (base/lib_addch.c) in the first
>   place. This behaviour is not expected.

ok.  The fragment we're discussing is (in lib_addch.c):

    if ((AttrOf(ch) & A_ALTCHARSET)
        || ((s = unctrl(t))[1] == 0 ||
            (   
                isprint(t)
#if USE_WIDEC_SUPPORT
                || WINDOW_EXT(win, addch_used)
#endif
            )))
        return waddch_literal(win, ch);

which should complement the Charable() macro in curses.priv.h (though I
can't use the same logic exactly).  The point is to make this call
waddch_literal() when the value in t is part of a multibyte sequence.

I think that something like this would do it:

    if ((AttrOf(ch) & A_ALTCHARSET)
        || (
                ((SP != 0 && SP->_legacy_coding)
                && (s = unctrl(t))[1] == 0)
        )
        || (   
                isprint(t)
#if USE_WIDEC_SUPPORT
                || WINDOW_EXT(win, addch_used)
                || !_nc_is_charable(CharOf(ch))
#endif
            ))
        return waddch_literal(win, ch);

and in ncurses.c test 'F' and 'f', that does indeed make it not display
a tilde-character.

However, I don't have a test-case for your locale.

Perhaps you can test this change (preferably against the current code -
see ftp://invisible-island.net/ncurses/5.4 for the rollup patch) and
see if any additional changes are needed.

>   To see if my idea is right, I removed the 128-160 part of unctrl
>   table(by comment out 2 lines in MKunctrl.awk), then rebuild the
>   ncurses library. After that, traditional Chinese characters are well
>   displayed. The two screenshots are in the attachment.
> 
>   So how can this be fixed? Thanks in advance.
> 
> Regards
> wwr
> 
> -- 
> Wang WenRui <address@hidden>
> PGP-Key-ID: 6ABE5DE0
> Registered GNU/Linux User #278717
> WWW: http://gnor.net/~roger/






> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-ncurses


-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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