Play nice with different encodings

This commit is contained in:
Sergey Kosarevsky 2016-02-29 17:42:48 +01:00
parent 9b13eacdf1
commit 43a2c5694e

View File

@ -1298,8 +1298,14 @@ private:
cont = handler.RawNumber(str, SizeType(length), false);
}
else {
const char* str = s.Pop();
SizeType length = static_cast<SizeType>(s.Length()) - 1;
StackStream<typename TargetEncoding::Ch> stackStream(stack_);
SizeType numCharsToCopy = s.Length();
while (numCharsToCopy--) {
Transcoder<SourceEncoding, TargetEncoding>::Transcode(is, stackStream);
}
stackStream.Put('\0');
const typename TargetEncoding::Ch* str = stackStream.Pop();
const SizeType length = static_cast<SizeType>(stackStream.Length()) - 1;
cont = handler.RawNumber(str, SizeType(length), true);
}