This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH] New wcwidth/wcswidth implementation (was Re: [Fwd: [1.7] wcwidth failing configure tests])
On May 13 11:03, Corinna Vinschen wrote:
> On May 12 15:47, Jeff Johnston wrote:
> > Corinna Vinschen wrote:
> >> On May 12 19:31, Corinna Vinschen wrote:
> >>> On May 12 17:56, Andy Koppe wrote:
> >>>> There's Markus Kuhn's wcwidth implementation, which says it's based on
> >>>> Unicode 5.0:
> >>>>
> >>>> http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
> >>>>
> >>>[...]
> >> Jeff, is that wcwidth something for newlib? I'd be willing to tweak
> >> it for newlib and to add the surrogate pair handling to wcswidth.
> >>
> > Sure.
>
> Patch below. It replaces wcwidth with the implementation from Markus Kuhn,
> adds the _jp2uc conversion necessary for the japanese charsets, and adds
> surrogate pair handling to wcwidth and wcswidth.
>
> Tested on Cygwin. Ok to check in?
>
> Btw., what about my question concerning upgrade of the iswXXX functions
> (actually the utf8 character class tables) to Unicode 5?
>
>
> Thanks,
> Corinna
>
>
> * libc/string/local.h: New file.
> * libc/string/wcswidth.c (wcswidth): Convert japanese wide
> characters to Unicode here. Handle surrogate pairs for UTF-16
> systems. Call __wcwidth rather than wcwidth.
> * libc/string/wcwidth.c: New implementation using Markus Kuhn's
> wcwidth implementation for Unicode.
> (bisearch): New static function.
> (__wcwidth): New function. Take wint_t rather than wchar_t as
> parameter to allow full Unicode handling on UTF-16 systems.
> (wcwidth): Convert japanese wide characters to Unicode here.
> Call __wcwidth rather than using iswprint/iswcntrl.
Disregard this patch, I created a new one.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat