From c9e941c5ed98f31ec39943cabd41f412d2c75f74 Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Tue, 4 Jan 2022 16:32:38 +0200 Subject: [PATCH] Fix #2681 - Make detail::print handle UTF-8 --- include/fmt/color.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/fmt/color.h b/include/fmt/color.h index dfbe4829..06b80911 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -530,7 +530,10 @@ void vprint(std::FILE* f, const text_style& ts, const S& format, basic_memory_buffer buf; detail::vformat_to(buf, ts, to_string_view(format), args); buf.push_back(Char(0)); - detail::fputs(buf.data(), f); + if (detail::is_utf8()) + detail::print(f, basic_string_view(buf.begin(), buf.size())); + else + detail::fputs(buf.data(), f); } /**