From: Piotr Caban piotr@codeweavers.com
--- dlls/msvcrt/locale.c | 7 ++++++- dlls/ucrtbase/tests/file.c | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index 6fc45b3bdbe..380571b72fc 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -1506,7 +1506,12 @@ static pthreadlocinfo create_locinfo(int category, locinfo->ctype1[j+1] |= _LEADBYTE;
for(i=0; i<256; i++) { - if(locinfo->pctype[i] & _LEADBYTE) + if (locinfo->lc_codepage == CP_UTF8) + { + buf[i] = (i >= 0x80) ? ' ' : i; + if (i >= 0x80) locinfo->ctype1[i+1] = (i >= 0xc2 && i <= 0xf4) ? _LEADBYTE : 0; + } + else if(locinfo->pctype[i] & _LEADBYTE) buf[i] = ' '; else buf[i] = i; diff --git a/dlls/ucrtbase/tests/file.c b/dlls/ucrtbase/tests/file.c index d5303a6020c..47971c76f95 100644 --- a/dlls/ucrtbase/tests/file.c +++ b/dlls/ucrtbase/tests/file.c @@ -232,6 +232,7 @@ static void test_utf8(const char *argv0) intptr_t hfind, hproc; WCHAR bufW[256], *pW; struct _stat64 stat; + unsigned int i; FILE *f; int ret;
@@ -241,6 +242,24 @@ static void test_utf8(const char *argv0) return; }
+ for (i = 128; i < 256; ++i) + { + unsigned int v; + + winetest_push_context("%#x", i); + v = tolower(i); + ok(i == v, "got %#x.\n", v); + v = toupper(i); + ok(i == v, "got %#x.\n", v); + + v = _isctype(i, ~0u); + if (i >= 0xc2 && i <= 0xf4) + ok(v == _LEADBYTE, "got %#x.\n", v); + else + ok(!v, "got %#x.\n", v); + winetest_pop_context(); + } + ret = _mkdir(dir); if (ret == -1 && errno == ENOENT) {