Commit ac5370fb authored by Johannes Zarl-Zierl's avatar Johannes Zarl-Zierl

Fix regression introduced by d34534b5

When fixing the referenced deprecation warning, I failed to faithfully
implement the old behaviour, which was thankfully caught by the
integration test.

Note: the bad implementation was not released yet.
parent d6f6b90a
...@@ -491,8 +491,11 @@ QString XMLDB::FileWriter::escape(const QString &str) ...@@ -491,8 +491,11 @@ QString XMLDB::FileWriter::escape(const QString &str)
if (useCompressedFileFormat()) { if (useCompressedFileFormat()) {
while ((pos = rx.indexIn(tmp, pos)) != -1) { while ((pos = rx.indexIn(tmp, pos)) != -1) {
QString before = rx.cap(1); QString before = rx.cap(1);
QString after = QString::fromLatin1("_."); // the old version called QString::sprintf("_.%0X", rx.cap(1).toLatin1())
after += QString::fromLocal8Bit(rx.cap(1).toLatin1().toHex()); // -> by using the hex value, the string is essentially cast as a number, creating the leading 0xff bytes
// since the latin1 is always 1 byte, we should always have 3 leading 0xff bytes, i.e. 6 'F' in total:
QString after = QString::fromLatin1("_.FFFFFF");
after += QString::fromLocal8Bit(rx.cap(1).toLatin1().toHex().toUpper());
tmp.replace(pos, before.length(), after); tmp.replace(pos, before.length(), after);
pos += after.length(); pos += after.length();
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment