xlocale

xlocale broken on OS X?

末鹿安然 提交于 2019-12-21 17:36:03
问题 I have a simple program that tests converting between wchar_t and char using a series of locales passed to it on the command line. It outputs a list of the conversions that fail by printing out the locale name and the string that failed to convert. I'm building it using clang and libc++. My understanding is that libc++'s named locale support is provided by the xlocale library on OS X. I'm seeing some unexpected failures, as well as some instances where conversion should fail, but doesn't.

xlocale broken on OS X?

守給你的承諾、 提交于 2019-12-04 08:47:45
I have a simple program that tests converting between wchar_t and char using a series of locales passed to it on the command line. It outputs a list of the conversions that fail by printing out the locale name and the string that failed to convert. I'm building it using clang and libc++. My understanding is that libc++'s named locale support is provided by the xlocale library on OS X. I'm seeing some unexpected failures, as well as some instances where conversion should fail, but doesn't. Here's the program. #warning call this program like: "locale -a | ./a.out" or pass \ locale names valid

Setting locales on OS X crashes

天大地大妈咪最大 提交于 2019-12-01 00:46:35
问题 The following code works fine on Linux but throws an exception on OS X 10.7: #include <iostream> #include <locale> #include <stdexcept> int main() try { std::locale::global(std::locale("")); std::cout << "Using locale: " << std::locale().name() << "\n"; } catch (std::runtime_error const& e) { std::cout << e.what() << "\n"; return 1; } The output on OS X is: locale::facet::_S_create_c_locale name not valid However, the standard explicitly says that The set of valid string argument values is "C

Setting locales on OS X crashes

99封情书 提交于 2019-11-30 20:03:13
The following code works fine on Linux but throws an exception on OS X 10.7: #include <iostream> #include <locale> #include <stdexcept> int main() try { std::locale::global(std::locale("")); std::cout << "Using locale: " << std::locale().name() << "\n"; } catch (std::runtime_error const& e) { std::cout << e.what() << "\n"; return 1; } The output on OS X is: locale::facet::_S_create_c_locale name not valid However, the standard explicitly says that The set of valid string argument values is "C" , "" , and any implementation-defined values. So whatever causes the behaviour above is violating the