C++ std::locale's ctor only accepts "C" and "POSIX"
C++ std::locale's ctor only accepts "C" and "POSIX"
- Subject: C++ std::locale's ctor only accepts "C" and "POSIX"
- From: Patrick Rutkowski <email@hidden>
- Date: Sat, 8 Mar 2008 21:57:34 -0500
I'm currently studying how locales work in C/C++, I'm using OS X
machine and a Linux machine for testing.
I wrote the following test program to make sure that I can
successfully initialize a few locales on both my systems: http://www.rutski89.com:31597/upload/test.cpp
Running this on my linux machine I get exactly the output I expected,
all success:
=== BEGING TERMINAL OUTPUT ===
Trying c locales...
Succeeded in calling setlocale(LC_ALL, "C")
Succeeded in calling setlocale(LC_ALL, "POSIX")
Succeeded in calling setlocale(LC_ALL, "en_US")
Succeeded in calling setlocale(LC_ALL, "en_US.UTF-8")
Succeeded in calling setlocale(LC_ALL, "pl_PL")
Succeeded in calling setlocale(LC_ALL, "pl_PL.ISO8859-2")
Trying C++ locales...
Succeeded ctor for std::locale with "C"
Succeeded ctor for std::locale with "POSIX"
Succeeded ctor for std::locale with "en_US"
Succeeded ctor for std::locale with "en_US.UTF-8"
Succeeded ctor for std::locale with "pl_PL"
Succeeded ctor for std::locale with "pl_PL.ISO8859-2"
=== END TERMINAL OUTPUT ===
However, when running on my OS X machine with the stock g++ (running
on 10.5.1) I get the following:
=== BEGING TERMINAL OUTPUT ===
Trying c locales...
Succeeded in calling setlocale(LC_ALL, "C")
Succeeded in calling setlocale(LC_ALL, "POSIX")
Succeeded in calling setlocale(LC_ALL, "en_US")
Succeeded in calling setlocale(LC_ALL, "en_US.UTF-8")
Succeeded in calling setlocale(LC_ALL, "pl_PL")
Succeeded in calling setlocale(LC_ALL, "pl_PL.ISO8859-2")
Trying C++ locales...
Succeeded ctor for std::locale with "C"
Succeeded ctor for std::locale with "POSIX"
Failed ctor for std::locale with "en_US"
Failed ctor for std::locale with "en_US.UTF-8"
Failed ctor for std::locale with "pl_PL"
Failed ctor for std::locale with "pl_PL.ISO8859-2"
=== END TERMINAL OUTPUT ===
It seems that the system is only able to create C++ locales for "C"
and "POSIX", which is puzzling, and also very unsatisfactory.
It would be unhappy, but at least settling, if I found a page that
said something like "C++ locales on OS X only support "C" and "POSIX",
tough luck!". However, such a page is nowhere to be found, and in fact
I have found evidence to the contrary.
Searching "site:apple.com std::locale" in google brings up various
pages where people describe issues with the usage of std::locale.
However, these pages pertain to issues with the usage of the locale
after it has already been created, which implies that the people who
made the posts were actually able to create the locale to begin with;
so why am I not able to create them?
I've been banging my head against the wall for a while now; any help
would be much appreciated
-Patrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden