diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp index 44c24d0493a97b..009ee1e4e2f4c5 100644 --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -4543,6 +4543,18 @@ static bool checked_string_to_wchar_convert(wchar_t& dest, } #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#ifdef _LIBCPP_HAS_NO_WIDE_CHARACTERS +static bool is_narrow_non_breaking_space(const char* ptr) { + // https://www.fileformat.info/info/unicode/char/202f/index.htm + return ptr[0] == '\xe2' && ptr[1] == '\x80' && ptr[2] == '\xaf'; +} + +static bool is_non_breaking_space(const char* ptr) { + // https://www.fileformat.info/info/unicode/char/0a/index.htm + return ptr[0] == '\xc2' && ptr[1] == '\xa0'; +} +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS + static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t __loc) { @@ -4575,6 +4587,13 @@ static bool checked_string_to_char_convert(char& dest, return false; } #else // _LIBCPP_HAS_NO_WIDE_CHARACTERS + // FIXME: Work around specific multibyte sequences that we can reasonably + // translate into a different single byte. + if (is_narrow_non_breaking_space(ptr) || is_non_breaking_space(ptr)) { + dest = ' '; + return true; + } + return false; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS _LIBCPP_UNREACHABLE(); diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp index b1efbb5fa5aa78..450d8b89bb7502 100644 --- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp @@ -13,9 +13,6 @@ // XFAIL: LIBCXX-WINDOWS-FIXME -// TODO(mordante): Investigate these localization/format failures since updating the Docker image in CI -// UNSUPPORTED: stdlib=libc++ - // REQUIRES: locale.fr_FR.UTF-8 // diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp index d155e099b9f851..01b61d1a17dfd9 100644 --- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp @@ -13,9 +13,6 @@ // XFAIL: LIBCXX-WINDOWS-FIXME -// TODO(mordante): Investigate these localization/format failures since updating the Docker image in CI -// UNSUPPORTED: stdlib=libc++ - // REQUIRES: locale.fr_FR.UTF-8 // diff --git a/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp b/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp index 9a991451aed12d..49536259164853 100644 --- a/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp @@ -11,9 +11,6 @@ // XFAIL: LIBCXX-WINDOWS-FIXME -// TODO(mordante): Investigate these localization/format failures since updating the Docker image in CI -// UNSUPPORTED: stdlib=libc++ - // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ru_RU.UTF-8 diff --git a/libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp b/libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp index 004ede52c44b02..555d37db278be1 100644 --- a/libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp +++ b/libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp @@ -11,9 +11,6 @@ // XFAIL: LIBCXX-WINDOWS-FIXME -// TODO(mordante): Investigate these localization/format failures since updating the Docker image in CI -// UNSUPPORTED: stdlib=libc++ - // REQUIRES: locale.en_US.UTF-8 // REQUIRES: locale.fr_FR.UTF-8