Date: Wed, 30 Dec 2009 17:03:52 GMT From: Stefan Krah <stefan-usenet@bytereef.org> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/142173: localeconv: two-byte ascii thousands_sep Message-ID: <200912301703.nBUH3qes044935@www.freebsd.org> Resent-Message-ID: <200912301710.nBUHA24o031034@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 142173 >Category: misc >Synopsis: localeconv: two-byte ascii thousands_sep >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Dec 30 17:10:02 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Stefan Krah >Release: 8.0-RELEASE-i386 >Organization: >Environment: >Description: The following locales have a two-byte ascii thousands separator. In all cases, the real separator is followed by an ascii whitespace character. In the attached test program, the separator is enclosed in XXX: it_CH.ISO8859-1: XXX. XXX it_CH.ISO8859-15: XXX. XXX it_CH.UTF-8: XXX. XXX it_IT.ISO8859-1: XXX. XXX it_IT.ISO8859-15: XXX. XXX it_IT.UTF-8: XXX. XXX sl_SI.ISO8859-2: XXX XXX sl_SI.UTF-8: XXX XXX >How-To-Repeat: Compile the test program. Run: locale -a | ./printsep >Fix: Patch attached with submission follows: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> int main(void) { char loc[100]; size_t n; while (fgets(loc, 100, stdin) != NULL) { n = strlen(loc); if (n > 1) { loc[n-1] = '\0'; setlocale(LC_ALL, loc); n = mbstowcs(NULL, localeconv()->thousands_sep, 0); if (n > 1) { printf("%s: XXX%sXXX\n", loc, localeconv()->thousands_sep); } } } return 0; } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912301703.nBUH3qes044935>