aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/src/locale.cpp
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-02-10 17:53:52 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-02-10 17:53:52 +0300
commit5c64b97bb7e4034eff8833e4c367f61d34fcb4ee (patch)
tree7c5769528f2fcdaa5a718aa73e4aa64d50905269 /contrib/libs/cxxsupp/libcxx/src/locale.cpp
parent1b56f620ac98766b198121ca1b728e7e61efbb56 (diff)
downloadydb-5c64b97bb7e4034eff8833e4c367f61d34fcb4ee.tar.gz
intermediate changes
ref:4635f4dd763168c3fa295f87727595c785b4d5a4
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/src/locale.cpp')
-rw-r--r--contrib/libs/cxxsupp/libcxx/src/locale.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/src/locale.cpp b/contrib/libs/cxxsupp/libcxx/src/locale.cpp
index 42b5641b43..ec8a811262 100644
--- a/contrib/libs/cxxsupp/libcxx/src/locale.cpp
+++ b/contrib/libs/cxxsupp/libcxx/src/locale.cpp
@@ -4561,6 +4561,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) {
@@ -4593,6 +4605,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();