From fc07217d85e6dcec52878807d6bbd89a9d9156a5 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 2 Nov 2022 15:42:47 -0700 Subject: [PATCH] Make utf-8 detection compatible with gbk --- include/fmt/core.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 5f44a9748e46..eea2ebcb1cb5 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -408,13 +408,13 @@ FMT_CONSTEXPR auto to_unsigned(Int value) -> return static_cast::type>(value); } -FMT_MSC_WARNING(suppress : 4566) constexpr unsigned char micro[] = "\u00B5"; +FMT_MSC_WARNING(suppress : 4566) constexpr unsigned char section[] = "\u00A7"; constexpr auto is_utf8() -> bool { // Avoid buggy sign extensions in MSVC's constant evaluation mode (#2297). using uchar = unsigned char; - return FMT_UNICODE || (sizeof(micro) == 3 && uchar(micro[0]) == 0xC2 && - uchar(micro[1]) == 0xB5); + return FMT_UNICODE || (sizeof(section) == 3 && uchar(section[0]) == 0xC2 && + uchar(section[1]) == 0xA7); } FMT_END_DETAIL_NAMESPACE