Improve error message.
This commit is contained in:
parent
d9a0168bfa
commit
5a85c8a95b
@ -10,6 +10,8 @@ char disable_linker_warning_about_empty_file_wstring_convert_cpp TD_UNUSED;
|
|||||||
|
|
||||||
#if TD_PORT_WINDOWS
|
#if TD_PORT_WINDOWS
|
||||||
|
|
||||||
|
#include "td/utils/base64.h"
|
||||||
|
#include "td/utils/SliceBuilder.h"
|
||||||
#include "td/utils/utf8.h"
|
#include "td/utils/utf8.h"
|
||||||
|
|
||||||
#include <cwchar>
|
#include <cwchar>
|
||||||
@ -18,7 +20,7 @@ namespace td {
|
|||||||
|
|
||||||
Result<std::wstring> to_wstring(CSlice slice) {
|
Result<std::wstring> to_wstring(CSlice slice) {
|
||||||
if (!check_utf8(slice)) {
|
if (!check_utf8(slice)) {
|
||||||
return Status::Error("Wrong string encoding");
|
return Status::Error(PSLICE() << "String was expected to be encoded in UTF-8: " << base64_encode(slice));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wstring_len = utf8_utf16_length(slice);
|
size_t wstring_len = utf8_utf16_length(slice);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user