[Bug 233244] mbtowc and wctomb are broken for all single-byte locales (except for C)

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Nov 15 21:24:27 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233244

            Bug ID: 233244
           Summary: mbtowc and wctomb are broken for all single-byte
                    locales (except for C)
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: yuripv at FreeBSD.org

Looking at bug #211762, I noticed that mbtowc() and wctomb() don't do any
conversion when LC_CTYPE is a single-byte locale (e.g. lv_LV.ISO8859-13 or
ru_RU.KOI8-R), and simply fill the output buffer with the input value.

POSIX defines mbtowc, for example, as "mbtowc - convert a character to a
wide-character code", and "The behavior of this function is affected by the
LC_CTYPE category of the current locale.", so there's nothing pointing to
single-byte locales being any special and not requiring conversion.

glibc (as found in Debian GNU/Linux) correctly converts characters from
single-byte-locales-other-than-C to corresponding wide ones.  OTOH, single-byte
locales are losing their significance, and fixing this could be just not worth
the effort required for testing the changes, more so as this doesn't seem to be
reported previously.

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


More information about the freebsd-bugs mailing list