wcswidth bugged?

Following sample code print 1 on solaris and linux and 2 on macosx 10.5.5
Probably there are there some workarounds or fixes?

#include <wchar.h>
#include <stdio.h>
#include <locale.h>

int main()
{
setlocale(LC CTYPE,"ruRU.UTF-8");
wchar_t s[2]={0x0435,0x0308};
printf("%d\n",wcswidth(s,2));
}

macmini, Mac OS X (10.5.5)

Posted on Nov 17, 2008 2:20 AM

Reply
3 replies

Nov 17, 2008 6:49 AM in response to Xecutor

Yes, this is an old bug of MacOSX. I have sent a bug report a few years ago but it seems Apple have completely ignored it. Please send a bug report to meke them aware of the problem.

As a workaround, you can use a version of wcwidth()/wcswidth() written by Markus Kuhn: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c

Or you may try a version in [Gnulib|http://www.gnu.org/software/gnulib>.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

wcswidth bugged?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.