This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
locale for Japanese Windows environment
- From: Tsunehiko <soft_wind at nifty dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 27 Feb 2010 03:31:23 -0800 (PST)
- Subject: locale for Japanese Windows environment
Hi all,
My gcc is as follows:
Target : djgpp ( Japanese Windows XP / Windows Vista )
gcc version 4.4.2
I want to handle Japanese Kanji characters in file.
So I need to set std::locale for Japanese environment,
but exception is thrown from std::locale::facet for several
possible parameters to locale ctor.
I tried such parameters as :
ja_JP.eucjp
ja_JP.utf8
ja
japanese
Q1
What is the proper parameter to std::locale ctor
for Japanese Windows environment ?
see below code.
Q2
Can I check such a parameter by DOS command ?
My code is as follows:
--------------------------------------------
#include <string>
#include <iostream>
#include <fstream>
#include <locale>
using std::string;
using std::cout;
using std::locale;
int main( int argc, char *argv[ ] )
{
try {
string str = "japanese";
cout << str << "\n";
locale::global( locale( locale::classic( ), str.c_str( ),
LC_COLLATE ) ); // exception is thrown here
std::ifstream file( argv[1] );
string msg = file ? "OK" : "Error";
cout << msg;
}
catch ( std::exception const& e ) {
cout << "standard library exception : " << e.what( ) << '\n';
}
catch ( ... ) {
cout << "Exception !!" << '\n';
}
return 0;
}
--------------------------------------------
Thanks in advance.
Tsunehiko
--
View this message in context: http://old.nabble.com/locale-for-Japanese-Windows-environment-tp27727252p27727252.html
Sent from the gcc - Help mailing list archive at Nabble.com.