Localization: problems with toupper/tolower transformations of latin characters.
Sun Dec 11 20:33:00 GMT 2005
Just noticed I did something silly. My input is UTF-8, so the latin
characters will be multibyte. The tolower/toupper had no way to know how
to handle it.
So I converted everything to wchar_t, and it worked for both versions.
A got a hint for the C++ version in libstdc++ list: I needed decoupling
the wcout from the underlying stdio (?? I guess that's what
And in C one needs to use the w-functions: wcslen, wcscpy, towlower,
Jan Pfeifer wrote:
>I was trying to get propper transformation for upper/lower case
>characters in a generic way, at first in C++, but I noticed that the
>libc is apparently not converting correctly the latin characters.
>Running the attached code, that tries the C++ and C functions -- later I
>found out that libstdc++ uses libc for these, I get:
>ÃrfÃ£o (original string)
>ÃRFÃ£O (should be upper case string)
>ÃrfÃ£o (should be lower case string)
>Any ideas about what I could be missing ? Or is the library missing ?
>(I tried different locales, as commented in the code, and using UTF-8
>thanks in advance for any help/pointers!
>$ gcc --version
>gcc (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
>Copyright (C) 2005 Free Software Foundation, Inc.
>This is free software; see the source for copying conditions. There is NO
>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Yahoo! doce lar. FaÃ§a do Yahoo! sua homepage.
More information about the Gcc-help