954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

conversion of a single wchar_t with toupper

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

denkfix
Newbie Poster
4 posts since May 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: