Hi,
I am trying to convert a single wchar_t to uppercase. In theory it should work as shown below, in practice it does not. I have no idea what I am doing wrong. Any ideas?
Output is:
T
T
?
?
#include <locale>
#include <string>
int main ( )
{
std::locale loc ( "en_US.UTF-8" );
//std::locale loc ( "de_DE.utf8" ); // I also tried this
std::wcout.imbue ( loc );
std::wcout << std::toupper<wchar_t> ( L't', loc ) << L'\n';
std::wcout << std::use_facet< std::ctype<wchar_t> >(loc).toupper
( L't' ) << L'\n';
std::wcout << std::toupper<wchar_t> ( L'ä', loc ) << L'\n';
std::wcout << std::use_facet< std::ctype<wchar_t> >(loc).toupper
( L'ä' ) << L'\n';
return 0;
}
Please note that I really want to use standard c++ for solving the problem.
Many thanks in advance,
Kay