[scribus] ?==?utf-8?q? xtg fileimport
rm at mh-freiburg.de
Tue Jun 5 14:21:23 UTC 2018
Am Dienstag, 05. Juni 2018 15:35 CEST, "Ralf Mattes" <r.mattes at mh-freiburg.de> schrieb:
> - from what I can tell the xtg import plugin correctly detects the declared encoding and does find
> the corrent QTextCodec for the encoding, so m_codec seems to be correct. But somehow the
> actual text imported is garbled.
> - If I import non-multibyte encoded text everything works as expected.
> Cheers, RalfD
After a bit of code reading:
in file xtgscanner.cpp, line 1460:
char ch = 0;
if (top < input_Buffer.length())
ch = input_Buffer.at(top++);
QString m_txt = m_codec->toUnicode(ba);
How is this supposed to work? 'ba' will contain a single _char_ which is passed to QTextCodec::toUnicode.
Isn't that guaranteed to return invaild glyphs for multibyte input since the first byte of a multibyte character
never is a vaild glyph?
Also, in the constructor XtgScanner::XtgScanner there seems to be an attempt to skip over BOM:
if ((input_Buffer == '\xFF') && (input_Buffer == '\xFE'))
for (int a = 2; a < input_Buffer.count(); a += 2)
input_Buffer = tmpBuf;
Won't this fail for UTF-16-LE (or, for that matter, for UTF-8 with BOM)?
More information about the scribus