debugger: fix new wstring dumper encoding

This commit is contained in:
hjk
2010-03-05 11:10:58 +01:00
parent 72ecc8a4fa
commit ed4278aba3
2 changed files with 37 additions and 9 deletions

View File

@@ -646,13 +646,20 @@ QString decodeData(const QByteArray &ba, int encoding)
//qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n";
return doubleQuote + QString::fromLatin1(decodedBa) + doubleQuote;
}
case 7: { // %04x encoded 16 bit data
case 7: { // %04x encoded 16 bit data, Little Endian
const QChar doubleQuote(QLatin1Char('"'));
const QByteArray decodedBa = QByteArray::fromHex(ba);
//qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n";
return doubleQuote + QString::fromUtf16(reinterpret_cast<const ushort *>
(decodedBa.data()), decodedBa.size() / 2) + doubleQuote;
}
case 8: { // %08x encoded 32 bit data, Little Endian
const QChar doubleQuote(QLatin1Char('"'));
const QByteArray decodedBa = QByteArray::fromHex(ba);
//qDebug() << quoteUnprintableLatin1(decodedBa) << "\n\n";
return doubleQuote + QString::fromUcs4(reinterpret_cast<const uint *>
(decodedBa.data()), decodedBa.size() / 4) + doubleQuote;
}
}
qDebug() << "ENCODING ERROR: " << encoding;
return QCoreApplication::translate("Debugger", "<Encoding error>");