locale for Japanese Windows environment
Tsunehiko
soft_wind@nifty.com
Sat Feb 27 18:01:00 GMT 2010
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-tp27727249p27727249.html
Sent from the gcc - Help mailing list archive at Nabble.com.
More information about the Gcc-help
mailing list