mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
Improve UTF-8 support
This commit is contained in:
parent
e6b37b4aff
commit
7eec036d9a
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user