mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 00:21:13 +00:00
Fix UTF8ToUTF16.
This commit is contained in:
parent
73d98d5d17
commit
9830c52816
@ -176,12 +176,12 @@ fmt::internal::UTF8ToUTF16::UTF8ToUTF16(fmt::StringRef s) {
|
||||
CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, 0, 0);
|
||||
static const char ERROR[] = "cannot convert string from UTF-8 to UTF-16";
|
||||
if (length == 0)
|
||||
ThrowSystemError(GetLastError(), ERROR);
|
||||
ThrowWinError(GetLastError(), ERROR);
|
||||
buffer_.resize(length);
|
||||
length = MultiByteToWideChar(
|
||||
CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, &buffer_[0], length);
|
||||
if (length == 0)
|
||||
ThrowSystemError(GetLastError(), ERROR);
|
||||
ThrowWinError(GetLastError(), ERROR);
|
||||
}
|
||||
|
||||
fmt::internal::UTF16ToUTF8::UTF16ToUTF8(fmt::WStringRef s) {
|
||||
|
Loading…
Reference in New Issue
Block a user