Skip to content

Commit ba923f4

Browse files
committed
WIP: Fix fr_FR thousands_sep on Windows 11
1 parent 75b0d38 commit ba923f4

File tree

6 files changed

+26
-27
lines changed

6 files changed

+26
-27
lines changed

libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,17 @@ class my_facetw
5353
: Fw(refs) {}
5454
};
5555

56+
class Fwf
57+
: public std::moneypunct_byname<wchar_t, false>
58+
{
59+
public:
60+
explicit Fwf(const std::string& nm, std::size_t refs = 0)
61+
: std::moneypunct_byname<wchar_t, false>(nm, refs) {}
62+
};
63+
5664
static std::wstring convert_thousands_sep(std::wstring const& in) {
57-
return LocaleHelpers::convert_thousands_sep_fr_FR(in);
65+
Fwf f(LOCALE_fr_FR_UTF_8, 1);
66+
return LocaleHelpers::convert_thousands_sep(in, f.thousands_sep());
5867
}
5968
#endif // TEST_HAS_NO_WIDE_CHARACTERS
6069

libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_fr_FR.pass.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,17 @@ class my_facetw
5353
: Fw(refs) {}
5454
};
5555

56+
class Fwf
57+
: public std::moneypunct_byname<wchar_t, false>
58+
{
59+
public:
60+
explicit Fwf(const std::string& nm, std::size_t refs = 0)
61+
: std::moneypunct_byname<wchar_t, false>(nm, refs) {}
62+
};
63+
5664
static std::wstring convert_thousands_sep(std::wstring const& in) {
57-
return LocaleHelpers::convert_thousands_sep_fr_FR(in);
65+
Fwf f(LOCALE_fr_FR_UTF_8, 1);
66+
return LocaleHelpers::convert_thousands_sep(in, f.thousands_sep());
5867
}
5968
#endif // TEST_HAS_NO_WIDE_CHARACTERS
6069

libcxx/test/std/localization/locale.categories/category.monetary/locale.moneypunct.byname/thousands_sep.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ int main(int, char**)
115115
#if defined(_CS_GNU_LIBC_VERSION)
116116
const wchar_t fr_sep = glibc_version_less_than("2.27") ? L' ' : L'\u202F';
117117
#elif defined(_WIN32)
118-
const wchar_t fr_sep = L'\u00A0';
118+
const wchar_t fr_sep = L'\u202F';
119119
#elif defined(_AIX)
120120
const wchar_t fr_sep = L'\u202F';
121121
#else

libcxx/test/std/localization/locale.categories/facet.numpunct/locale.numpunct.byname/thousands_sep.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int main(int, char**)
7878
#if defined(_CS_GNU_LIBC_VERSION)
7979
const wchar_t wsep = glibc_version_less_than("2.27") ? L' ' : L'\u202f';
8080
#elif defined(_WIN32)
81-
const wchar_t wsep = L'\u00A0';
81+
const wchar_t wsep = L'\u202f';
8282
#else
8383
const wchar_t wsep = L',';
8484
#endif

libcxx/test/std/time/time.duration/time.duration.nonmember/ostream.pass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ static void test_values() {
8989
#endif
9090
} else {
9191
#ifdef _WIN32
92-
assert(stream_fr_FR_locale<CharT>(-1'000'000s) == SV("-1\u00A0000\u00A0000s"));
93-
assert(stream_fr_FR_locale<CharT>(1'000'000s) == SV("1\u00A0000\u00A0000s"));
94-
assert(stream_fr_FR_locale<CharT>(-1'000.123456s) == SV("-1\u00A0000,1235s"));
95-
assert(stream_fr_FR_locale<CharT>(1'000.123456s) == SV("1\u00A0000,1235s"));
92+
assert(stream_fr_FR_locale<CharT>(-1'000'000s) == SV("-1\u202F000\u202F000s"));
93+
assert(stream_fr_FR_locale<CharT>(1'000'000s) == SV("1\u202F000\u202F000s"));
94+
assert(stream_fr_FR_locale<CharT>(-1'000.123456s) == SV("-1\u202F000,1235s"));
95+
assert(stream_fr_FR_locale<CharT>(1'000.123456s) == SV("1\u202F000,1235s"));
9696
#elif defined(__APPLE__)
9797
assert(stream_fr_FR_locale<CharT>(-1'000'000s) == SV("-1000000s"));
9898
assert(stream_fr_FR_locale<CharT>(1'000'000s) == SV("1000000s"));

libcxx/test/support/locale_helpers.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,6 @@ std::wstring convert_thousands_sep(std::wstring const& in, wchar_t sep) {
4141
return out;
4242
}
4343

44-
// GLIBC 2.27 and newer use U+202F NARROW NO-BREAK SPACE as a thousands separator.
45-
// This function converts the spaces in string inputs to U+202F if need
46-
// be. FreeBSD's locale data also uses U+202F, since 2018.
47-
// Windows uses U+00A0 NO-BREAK SPACE.
48-
std::wstring convert_thousands_sep_fr_FR(std::wstring const& in) {
49-
#if defined(_CS_GNU_LIBC_VERSION)
50-
if (glibc_version_less_than("2.27"))
51-
return in;
52-
else
53-
return convert_thousands_sep(in, L'\u202F');
54-
#elif defined(__FreeBSD__)
55-
return convert_thousands_sep(in, L'\u202F');
56-
#elif defined(_WIN32)
57-
return convert_thousands_sep(in, L'\u00A0');
58-
#else
59-
return in;
60-
#endif
61-
}
62-
6344
// GLIBC 2.27 uses U+202F NARROW NO-BREAK SPACE as a thousands separator.
6445
// FreeBSD, AIX and Windows use U+00A0 NO-BREAK SPACE.
6546
std::wstring convert_thousands_sep_ru_RU(std::wstring const& in) {

0 commit comments

Comments
 (0)