Improve utf-8 detection
This commit is contained in:
+6
-2
@@ -420,7 +420,7 @@ struct is_std_string_like<T, void_t<decltype(std::declval<T>().find_first_of(
|
||||
typename T::value_type(), 0))>>
|
||||
: std::true_type {};
|
||||
|
||||
FMT_CONSTEXPR inline auto is_utf8() -> bool {
|
||||
FMT_CONSTEXPR inline auto is_utf8_enabled() -> bool {
|
||||
FMT_MSC_WARNING(suppress : 4566) constexpr unsigned char section[] = "\u00A7";
|
||||
// Avoid an MSVC sign extension bug: https://github.com/fmtlib/fmt/pull/2297.
|
||||
using uchar = unsigned char;
|
||||
@@ -428,7 +428,11 @@ FMT_CONSTEXPR inline auto is_utf8() -> bool {
|
||||
uchar(section[1]) == 0xA7;
|
||||
static_assert(utf8 || !FMT_MSC_VERSION,
|
||||
"Unicode support requires compiling with /utf-8");
|
||||
return FMT_UNICODE || utf8;
|
||||
return utf8;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR inline auto is_utf8() -> bool {
|
||||
return FMT_UNICODE || is_utf8_enabled();
|
||||
}
|
||||
|
||||
template <typename Char> FMT_CONSTEXPR auto length(const Char* s) -> size_t {
|
||||
|
||||
Reference in New Issue
Block a user