Bug 3949

Summary: wcwidth fails to be standards-compliant
Product: uClibc Reporter: Kiyoshi Aman <kiyoshi.aman>
Component: Standard ComplianceAssignee: unassigned
Status: REOPENED ---    
Severity: minor CC: uclibc-cvs
Priority: P5    
Version: 0.9.32   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Kiyoshi Aman 2011-07-04 11:16:19 UTC
The wcwidth function (and wcswidth, for that matter, since uClibc's wcwidth is implemented in terms of wcswidth) fails to be standards compliant. The following test should emit 'e-acute is 1 wide' on conforming implementations; uClibc's instead emits 'e-acute is -1 wide':

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

void main(void) {
  printf("e-acute is %d wide\n", wcwidth(0xe9));
}
Comment 1 Kiyoshi Aman 2011-07-04 11:18:07 UTC
I should note, http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c conforms to standards and is suitably licensed such that it could replace uClibc's implementation.
Comment 2 Kiyoshi Aman 2011-07-04 11:42:23 UTC
After further discussion, I'm going to take this up with Alpine Linux's libc team due to their disabling of locales.
Comment 3 Kiyoshi Aman 2011-07-04 22:42:06 UTC
Reopening because it makes no sense for wc(s)width to default to ASCII when locales are disabled. ASCII is not 'widechar' at all, particularly when the existing str* functions in string.h handle ASCII just fine.