// std::moneypunct implementation details, GNU version -*- C++ -*-
-// Copyright (C) 2001-2018 Free Software Foundation, Inc.
+// Copyright (C) 2001-2024 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
}
#endif
+ extern char __narrow_multibyte_chars(const char* s, __locale_t cloc);
+
template<>
void
moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
// Named locale.
_M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
__cloc));
- _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
- __cloc));
+ const char* thousands_sep = __nl_langinfo_l(__MON_THOUSANDS_SEP,
+ __cloc);
+ if (thousands_sep[0] != '\0' && thousands_sep[1] != '\0')
+ _M_data->_M_thousands_sep = __narrow_multibyte_chars(thousands_sep,
+ __cloc);
+ else
+ _M_data->_M_thousands_sep = *thousands_sep;
// Check for NULL, which implies no fractional digits.
if (_M_data->_M_decimal_point == '\0')