On Monday 09 April 2007 18:25:15 Michael Sweet wrote: > Millan wrote: > > Yes, but what I've also meant was that one has to use, for > > example, "setlocale(LC_CTYPE, "en_US.UTF-8")" and "wcscasecmp()" to perform > > case-insensitive comparison for non-ascii portion of UTF-8, if someone uses > > german for example. > > I don't say that current usage is incorrect, but I'm guessing that if one > > wants to perform already mentioned case-insensitive comparison then he has to > > iternally, within *his* program, set appropriate locale, translate UTF-8 > > encoded string to wide character string (mbstowcs()), then do the comparation > > (wcscasecmp()) and then finally if necessary convert that string back to > > UTF-8 string (wcstombs()), right? > > Yeah, or use any of a dozen other libraries for the task, praying > that the locale definitions match your notion of a case-insensitive > comparison and that the code handles comparing composed and > decomposed characters properly (which AFAIK the mbs functions don't...)
Forgive me if I maybe stray a little from the main topic, but currently I'm working on one FLTK app which would (should) be Unicode-aware, and frankly I've only recently started to learn about UTF-8. If I intend to, for example, compare two UTF-8 encoded string which were converted to wchar_t strings with "mbstowcs()", and if those two strings are in Serbian - cyrillic unicode space (one alphabet), does it matter if I set locale to "en_US.UTF-8", "de_DE.UTF-8" or "sr_CS.UTF-8" (which is Serbian locale) since all three are UTF-8 locales or it does not since wchar_t strings will probably be UTF-32 encoded (sizeof(wchar_t) == 4) or UTF-16 (sizeof(wchar_t) == 2)? If doesn't, in that case, once I convert UTF-8 strings to wchar_t strings (UTF-32 or UTF-16 encoded strings) what locale I need to set, because if I set "en_US" locale it will use "ISO-8859-1" charset, and then again if I set to "en_US.UTF-8" locale, then it will use UTF-8 encoding while strings will be UTF-32 or UTF-16 encoded?? Uh, I hope my questions are clear enough since I'm a little confused now with all of this, and to be honest, I would *really* like to avoid the use of some external confusing and cumbersome (but undoubtedly, powerful) libraries like ICU. _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

