mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
Clarify encoding conversion in chrono
This commit is contained in:
parent
6f435f55c8
commit
4a617f25c6
@ -774,6 +774,8 @@ OutputIt format_duration_unit(OutputIt out) {
|
|||||||
if (const char* unit = get_units<Period>()) {
|
if (const char* unit = get_units<Period>()) {
|
||||||
string_view s(unit);
|
string_view s(unit);
|
||||||
if (const_check(std::is_same<Char, wchar_t>())) {
|
if (const_check(std::is_same<Char, wchar_t>())) {
|
||||||
|
// This works when wchar_t is UTF-32 because units only contain code
|
||||||
|
// points that have the same values in UTF-16 and UTF-32.
|
||||||
utf8_to_utf16 u(s);
|
utf8_to_utf16 u(s);
|
||||||
return std::copy(u.c_str(), u.c_str() + u.size(), out);
|
return std::copy(u.c_str(), u.c_str() + u.size(), out);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user