* strfuncs.cc (sys_wcstombs): Don't convert ASCII SO into two

ASCII SO's.
This commit is contained in:
Corinna Vinschen 2009-03-25 13:54:41 +00:00
parent 6396c8889f
commit b10a036a92
2 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2009-03-25 Corinna Vinschen <corinna@vinschen.de>
* strfuncs.cc (sys_wcstombs): Don't convert ASCII SO into two
ASCII SO's.
2009-03-25 Corinna Vinschen <corinna@vinschen.de> 2009-03-25 Corinna Vinschen <corinna@vinschen.de>
* environ.cc (environ_init): Break from locale loop after first hit. * environ.cc (environ_init): Break from locale loop after first hit.

View File

@ -320,9 +320,8 @@ sys_wcstombs (char *dst, size_t len, const PWCHAR src, size_t nwc)
pw &= 0xff; pw &= 0xff;
int bytes = _wctomb_r (_REENT, buf, pw, &ps); int bytes = _wctomb_r (_REENT, buf, pw, &ps);
/* Convert chars invalid in the current codepage to a sequence /* Convert chars invalid in the current codepage to a sequence
ASCII SO; UTF-8 representation of invalid char. ASCII SO; UTF-8 representation of invalid char. */
Do the same for ASCII SO itself. */ if (bytes == -1 && *__locale_charset () != 'U'/*TF-8*/)
if ((bytes == -1 || pw == 0x0e) && *__locale_charset () != 'U'/*TF-8*/)
{ {
buf[0] = 0x0e; /* ASCII SO */ buf[0] = 0x0e; /* ASCII SO */
bytes = __utf8_wctomb (_REENT, buf + 1, pw, __locale_charset (), &ps); bytes = __utf8_wctomb (_REENT, buf + 1, pw, __locale_charset (), &ps);