Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2018 11:31:13 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 234010] Lack of Unicode support in strfmon breaks monitary formatting
Message-ID:  <bug-234010-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D234010

            Bug ID: 234010
           Summary: Lack of Unicode support in strfmon breaks monitary
                    formatting
           Product: Base System
           Version: 11.2-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: jon@herrskogen.se

This bug was manifested when using the PHP function money_format and
LC_MONETARY sv_SE.UTF-8 to format some currency. Instead of a space as the
thousand separator, it was a ?-symbol. I'm not very good at this, but this =
is
what I have come up with:

* FreeBSD is retrieving locale data from http://cldr.unicode.org
* In at least sv_SE.UTF-8, the value ending up as monitary thousand separat=
or
is a unicode character (C2 A0).
* localeconv is fetching the data in /usr/share/locale/sv_SE.UTF-8/LC_MONET=
ARY
and returning a pointer.
* __format_grouped_double (with the description "convert double to ASCII") =
is
calling localeconv to fetch the thousand separator and seems to only use the
first byte (C2).

* strfmon is calling __format_grouped_double to format the grouping of the
string and returns bad strings when using locales with unicode characters.


How to reproduce:

setlocale(LC_MONETARY, "sv_SE.UTF-8");
int i;
strfmon(buf, sizeof(buf), "%i", money);
printf("%s\n", buf);
for(i=3D0; i<sizeof(buf); i++) {
        printf("%2d - %i \n", i, buf[i]);
}

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-234010-227>