summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-04-08 11:06:07 -0500
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2024-04-10 18:15:19 +0000
commitdd0ddad631170e8825ea549eedc14c89712b0c1b (patch)
tree76a53b1afea2ddeb0d44c04c9781bd797a98dae0
parent22466dc051d53e2c29fbafced3a5c0c3c8b18750 (diff)
QText{En,De}coder: use DefaultConversion
In Qt 5, the flag to write the BOM was a negative: if IgnoreHeader wasn't set, we would write it. That was the default in Qt 5 because DefaultConversion was 0. But now it's a positive flag, DefaultConversion was updated to set it, but we forgot to use it in the constructors of these two classes. [ChangeLog][Qt5CoreCompat][QTextEncoder] Fixed a bug that caused QTextEncoder not to write the Byte Order Mark for UTF codecs when the constructor without explicit flags was used. Fixes: QTBUG-122795 Pick-to: 6.5 6.7 Change-Id: If1bf59ecbe014b569ba1fffd17c459af4e0e00c9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/core5/codecs/qtextcodec.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core5/codecs/qtextcodec.h b/src/core5/codecs/qtextcodec.h
index 0c239e1..b21393f 100644
--- a/src/core5/codecs/qtextcodec.h
+++ b/src/core5/codecs/qtextcodec.h
@@ -93,7 +93,8 @@ class Q_CORE5COMPAT_EXPORT QTextEncoder
{
Q_DISABLE_COPY(QTextEncoder)
public:
- explicit QTextEncoder(const QTextCodec *codec) : c(codec), state() {}
+ explicit QTextEncoder(const QTextCodec *codec)
+ : c(codec), state(QTextCodec::DefaultConversion) {}
explicit QTextEncoder(const QTextCodec *codec, QTextCodec::ConversionFlags flags);
~QTextEncoder();
QByteArray fromUnicode(const QString& str);
@@ -109,7 +110,8 @@ class Q_CORE5COMPAT_EXPORT QTextDecoder
{
Q_DISABLE_COPY(QTextDecoder)
public:
- explicit QTextDecoder(const QTextCodec *codec) : c(codec), state() {}
+ explicit QTextDecoder(const QTextCodec *codec)
+ : c(codec), state(QTextCodec::DefaultConversion) {}
explicit QTextDecoder(const QTextCodec *codec, QTextCodec::ConversionFlags flags);
~QTextDecoder();
QString toUnicode(const char* chars, int len);