From: Fehringer F. <Fra...@fj...> - 2005-05-09 10:44:29
|
Hello, With MinGW (MinGW-3.2.0-rc-3.exe plus MSYS-1.0.11-2004.04.30-1.exe) the following C Program using setlocale works: #include <locale.h> #include <ctype.h> #include <stdio.h> int main() { setlocale(LC_ALL, "german"); printf("%s\n", setlocale(LC_ALL, 0)); printf("%x\n", '=E4'); if (isalpha('=E4')) printf("Hurra!\n"); else printf("=C4chz!\n"); return 0; } It prints German_Germany.1252 ffffffc4 Hurra! (btw. why is hex(a umlaut) =3D=3D ffffffc4?) The following C++ program using std::locale does not work, it gives locale::facet::_S_create_c_locale name not valid #include <stdexcept> #include <locale> #include <iostream> using namespace std; int main() { try { locale de("german"); cout << de.name() << endl; cout << hex << '=E4' << endl; if (isalpha('=E4', de)) cout << "Hurra!" << endl; else cout << "=C4chz!" << endl; return 0; } catch (const exception& e) {cerr << e.what() << endl; return 1;} } Is localization generally disabled with MinGW-3.2.0-rc-3? Does this work with current snapshots or can this be enabled with = future ones? My compiler settings are export CC=3Dgcc export CXX=3Dg++ export CPPFLAGS=3D"-D_ALL_SOURCE -I/usr/local/include -I/usr/local/include/ncurses" export CFLAGS=3D"-std=3Dgnu99 $CPPFLAGS -pipe -march=3Dpentium4 -O3" export CXXFLAGS=3D"$CPPFLAGS -pipe -march=3Dpentium4 -O3" export LDFLAGS=3D"-L/usr/local/lib" g++ -v says Reading specs from = E:/Programme/MinGW/bin/../lib/gcc/mingw32/3.4.2/specs Configured with: ../gcc/configure --with-gcc --with-gnu-ld = --with-gnu-as --host=3Dmingw32 --target=3Dmingw32 --prefix=3D/mingw --enable-threads --disable-nls --enable-languages=3Dc,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=3Dboehm --disable-libgcj-debug --enable-interpreter = --enable-hash-synchronization --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.2 (mingw-special) I see --disable-nls, but this will disable only messages (warnings, = errors) by the compiler itself, not localization as a whole (so i would think). Thanks for helpful answers Franz |