Fixes example code in encoding
This commit is contained in:
parent
7cfe718d3d
commit
9eda05c286
@ -130,8 +130,17 @@ const char* s = "..."; // UTF-8 string
|
|||||||
StringStream source(s);
|
StringStream source(s);
|
||||||
GenericStringBuffer<UTF16<> > target;
|
GenericStringBuffer<UTF16<> > target;
|
||||||
|
|
||||||
Transcoder::Transcode<UTF8<>, UTF16<> >(source, target)
|
bool hasError = false;
|
||||||
|
while (source.Peak() != '\0')
|
||||||
|
if (!Transcoder::Transcode<UTF8<>, UTF16<> >(source, target)) {
|
||||||
|
hasError = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasError) {
|
||||||
const wchar_t* t = target.GetString();
|
const wchar_t* t = target.GetString();
|
||||||
|
// ...
|
||||||
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
You may also use `AutoUTF` and the associated streams for setting source/target encoding in runtime.
|
You may also use `AutoUTF` and the associated streams for setting source/target encoding in runtime.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user