FreeBSD Bugzilla – Attachment 207943 Details for
Bug 240911
iswprint() wrong for some FULL WIDTH characters in UTF-8 locale
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Modified reproducer
wcw.c (text/plain), 1.60 KB, created by
Daniel Ponte
on 2019-09-29 20:09:18 UTC
(
hide
)
Description:
Modified reproducer
Filename:
MIME Type:
Creator:
Daniel Ponte
Created:
2019-09-29 20:09:18 UTC
Size:
1.60 KB
patch
obsolete
>#include <stdio.h> >#include <wchar.h> >#include <wctype.h> >#include <string.h> >#include <locale.h> > > > >char DefaultLocale[30]; > >const char* CharClasses[] = {"alnum", "cntrl", "ideogram", "print", "space", "xdigit", > "alpha", "digit", "lower", "punct", "special", > "blank", "graph", "phonogram","rune", "upper"}; >const int CHAR_CLASS_SIZE = (sizeof(CharClasses) / sizeof(char*)); >wctype_t CharClassValues[(sizeof(CharClasses) / sizeof(char*))]; > >void test_locale(wchar_t c, const char* locale) { > setlocale(LC_ALL, locale); > const char* localeSetting = setlocale(LC_ALL, NULL); > printf("in %s locale, iswprint(%#x) = %d\n", localeSetting, c, !!iswprint(c)); >} > >void test_char(wchar_t c) { > > printf("Character %lc %#x is in classes: ", c, c); > for (int i=0; i< CHAR_CLASS_SIZE; i++) if (iswctype(c, CharClassValues[i])) printf("%s ", CharClasses[i]); > printf("\n"); > > test_locale(c, DefaultLocale); > test_locale(c, "en_US.UTF-8"); > test_locale(c, "ja_JP.UTF-8"); > printf("\n"); >} > >int >main() { > const char* initial_locale = setlocale(LC_ALL, NULL); > strncpy(DefaultLocale, initial_locale, 30); > DefaultLocale[29] = '\0'; > > for (int i=0; i< CHAR_CLASS_SIZE; i++) { > CharClassValues[i] = wctype(CharClasses[i]); > printf("%s:%#lx, ", CharClasses[i], CharClassValues[i]); > > } > > printf("\nDefault Locale is: %s\n", DefaultLocale); > test_char(L'\x64'); > test_char(L'\ue0b1'); > test_char(L'\ue0b2'); > test_char(L'\ue0b3'); > test_char(L'î°'); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 240911
: 207943