mirror of
https://github.com/fmtlib/fmt.git
synced 2026-02-16 23:29:57 +08: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);
|
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";
|
static const char ERROR[] = "cannot convert string from UTF-8 to UTF-16";
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
ThrowSystemError(GetLastError(), ERROR);
|
ThrowWinError(GetLastError(), ERROR);
|
||||||
buffer_.resize(length);
|
buffer_.resize(length);
|
||||||
length = MultiByteToWideChar(
|
length = MultiByteToWideChar(
|
||||||
CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, &buffer_[0], length);
|
CP_UTF8, MB_ERR_INVALID_CHARS, s.c_str(), -1, &buffer_[0], length);
|
||||||
if (length == 0)
|
if (length == 0)
|
||||||
ThrowSystemError(GetLastError(), ERROR);
|
ThrowWinError(GetLastError(), ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::internal::UTF16ToUTF8::UTF16ToUTF8(fmt::WStringRef s) {
|
fmt::internal::UTF16ToUTF8::UTF16ToUTF8(fmt::WStringRef s) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user