locale for Japanese Windows environment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux