From ac5370fb2492477606587278899df2300043c75b Mon Sep 17 00:00:00 2001 From: Johannes Zarl-Zierl Date: Thu, 23 Jul 2020 01:17:33 +0200 Subject: [PATCH] Fix regression introduced by d34534b5670bb5ca53afae8ed91446fc921f2a69 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. --- XMLDB/FileWriter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/XMLDB/FileWriter.cpp b/XMLDB/FileWriter.cpp index 3ee8581a..01557abf 100644 --- a/XMLDB/FileWriter.cpp +++ b/XMLDB/FileWriter.cpp @@ -491,8 +491,11 @@ QString XMLDB::FileWriter::escape(const QString &str) if (useCompressedFileFormat()) { while ((pos = rx.indexIn(tmp, pos)) != -1) { QString before = rx.cap(1); - QString after = QString::fromLatin1("_."); - after += QString::fromLocal8Bit(rx.cap(1).toLatin1().toHex()); + // the old version called QString::sprintf("_.%0X", rx.cap(1).toLatin1()) + // -> 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); pos += after.length(); } -- GitLab