B
Brad Tilley
I'm experimenting with std::locale. This code works:
int main()
{
// Get the run time locale.
const std::locale rt_locale( std::locale("") );
// Make the run time locale global.
std::locale::global( rt_locale );
// Print a few non-English Characters
std::wcout << L"\x2660 \x2661 \x2662 \x2663" << std::endl;
return 0;
}
However, adding this line breaks it:
// Print the run time locale
std::cout << rt_locale.name() << std::endl;
Here is working output:
$ ./a.out
♠♡ ♢ ♣
Here is broken output:
$ ./a.out
en_US.utf8
` a b c
I don't understand why .name() would cause this. I've never worked
with std::locale before, so I'm probably making some fundamental
mistake. Any advice is appreciated. Here's the g++ version I'm using:
g++ --version
g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3
int main()
{
// Get the run time locale.
const std::locale rt_locale( std::locale("") );
// Make the run time locale global.
std::locale::global( rt_locale );
// Print a few non-English Characters
std::wcout << L"\x2660 \x2661 \x2662 \x2663" << std::endl;
return 0;
}
However, adding this line breaks it:
// Print the run time locale
std::cout << rt_locale.name() << std::endl;
Here is working output:
$ ./a.out
♠♡ ♢ ♣
Here is broken output:
$ ./a.out
en_US.utf8
` a b c
I don't understand why .name() would cause this. I've never worked
with std::locale before, so I'm probably making some fundamental
mistake. Any advice is appreciated. Here's the g++ version I'm using:
g++ --version
g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3