|Summary:||mbtowc and wctomb are broken for all single-byte locales (except for C)|
|Product:||Base System||Reporter:||Yuri Pankov <yuripv>|
|Component:||bin||Assignee:||freebsd-bugs (Nobody) <bugs>|
|Severity:||Affects Some People|
Description Yuri Pankov 2018-11-15 21:24:25 UTC
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.