bug-ncurses
[Top][All Lists]
Advanced

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

Patch to libmenu to correctly support UTF-8 with wide-char support


From: Dr.Philipp Tomsich
Subject: Patch to libmenu to correctly support UTF-8 with wide-char support
Date: Sat, 01 May 2004 00:16:47 +0200

Hi,
                                                                                
libmenu contains a two subtle issues, which makes it difficult to use
with UTF-8:
                                                                                
* new_item(3MENU) tests for printable characters using isprint(3), which
  is not UTF-8 aware and consequently indicates UTF-8-encoded characters
  as non-printable; this leads to NULL being returned instead of a new
  item allocated.
* m_post_item uses the result from strlen(3) [cached from the
  initialization of the ITEM structure in new_item] to calculate the
  number of spaces necessary between the item's name and the item's
  description. However, this returns the number of bytes, not the
  number of output characters for UTF8.
                                                                                
The attached patch fixes these two issues (when ncurses is compiled with
wide-char support only). It has been tested with Debian/Sid and should
be compatible across a with range of flavours.
                                                                                
cheers,
--phil.

-- 
Dr. Philipp Tomsich                            GSM: +43 (0)676 844410-60
Arbeitsgruppe RISE, TU Wien                                    RISE:COSM
Prinz-Eugen Strasse 18/2/DG                    Concorde Business Park 2A
A-1040 Wien                                             A-2320 Schwechat

Attachment: ncurses-diff
Description: Text Data


reply via email to

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