From 4a617f25c60451e5767b2e095233b05f09ea8720 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 27 Apr 2020 09:57:08 -0700 Subject: [PATCH] Clarify encoding conversion in chrono --- include/fmt/chrono.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 421d464a..2aed3143 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -774,6 +774,8 @@ OutputIt format_duration_unit(OutputIt out) { if (const char* unit = get_units()) { string_view s(unit); if (const_check(std::is_same())) { + // 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); return std::copy(u.c_str(), u.c_str() + u.size(), out); }