Improve UTF-8 support

This commit is contained in:
Victor Zverovich 2019-12-21 19:53:52 -08:00
parent e6b37b4aff
commit 7eec036d9a

View File

@ -1336,11 +1336,20 @@ FMT_FUNC void report_system_error(int error_code,
report_error(format_system_error, error_code, message);
}
#ifndef FMT_UNICODE
# define FMT_UNICODE 0
#endif
FMT_FUNC void vprint(std::FILE* f, string_view format_str, format_args args) {
memory_buffer buffer;
internal::vformat_to(buffer, format_str,
basic_format_args<buffer_context<char>>(args));
#if FMT_UNICODE
internal::utf8_to_utf16 u16(string_view(buffer.data(), buffer.size()));
std::fputws(u16.c_str(), f);
#else
internal::fwrite_fully(buffer.data(), 1, buffer.size(), f);
#endif
}
FMT_FUNC void vprint(string_view format_str, format_args args) {