* environ.cc (environ_init): Break from locale loop after first hit.

* fhandler_console.cc (fhandler_console::write_normal): Print a SO
	sequence using always valid Unicode chars.
This commit is contained in:
Corinna Vinschen 2009-03-25 12:29:04 +00:00
parent f276aab75a
commit 5354e13fe6
3 changed files with 29 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2009-03-25 Corinna Vinschen <corinna@vinschen.de>
* environ.cc (environ_init): Break from locale loop after first hit.
* fhandler_console.cc (fhandler_console::write_normal): Print a SO
sequence using always valid Unicode chars.
2009-03-25 Corinna Vinschen <corinna@vinschen.de>
* strfuncs.cc (__kr_wctomb): Use codepage 51949 rather than 50949.

View File

@ -791,7 +791,10 @@ environ_init (char **envp, int envc)
char *buf = (char *) alloca (i);
GetEnvironmentVariableA (lc_arr[lc], buf, i);
if (_setlocale_r (_GLOBAL_REENT, LC_CTYPE, buf))
got_lc = true;
{
got_lc = true;
break;
}
}
}
/* No matching POSIX environment variable, use current codepage. */

View File

@ -1573,7 +1573,25 @@ fhandler_console::write_normal (const unsigned char *src,
cursor_set (false, 0, y);
break;
case ERR:
/* Don't print chars marked as ERR chars. */
/* Don't print chars marked as ERR chars, except for a SO sequence
which is printed as singlebyte chars from the UTF Basic Latin
and Latin 1 Supplement plains. */
if (*found == 0x0e)
{
write_replacement_char ();
if (found + 1 < end)
{
ret = __utf8_mbtowc (_REENT, NULL, (const char *) found + 1,
end - found - 1, NULL, &ps);
if (ret != (size_t) -1)
while (ret-- > 0)
{
WCHAR w = *(found + 1);
WriteConsoleW (get_output_handle (), &w, 1, &done, 0);
found++;
}
}
}
break;
case TAB:
cursor_get (&x, &y);