diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-10-27 10:45:47 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-10-28 12:17:13 +0100 |
commit | 1abcc1cd3d1a8d04ccfd711c3293d0c671af3c78 (patch) | |
tree | 9e035ed1d4748d4fd8d469961b71e460a7f7d85a /src/corelib/codecs | |
parent | 6080db8c6d345cf4ad573215828246e86f9dc41b (diff) |
Hardcode UTF-8 for "unicode" in QTextCodec::codecForHtml().
ICU would return a utf-16 (endian dependent) codec for unicode
which is very rarely what people want. In most cases, unicode is
encoded in utf8 these days, so return a utf8 codec for it.
Task-number: QTBUG-41998
Change-Id: I51ee758d520702b263a8b2011787eb1f3455ed96
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib/codecs')
-rw-r--r-- | src/corelib/codecs/qtextcodec.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 24cb4e7038..9af307ca17 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -1049,7 +1049,10 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba, QTextCodec *defaultCo while (++pos2 < header.size()) { char ch = header.at(pos2); if (ch == '\"' || ch == '\'' || ch == '>') { - c = QTextCodec::codecForName(header.mid(pos, pos2 - pos)); + QByteArray name = header.mid(pos, pos2 - pos); + if (name == "unicode") // QTBUG-41998, ICU will return UTF-16. + name = QByteArrayLiteral("UTF-8"); + c = QTextCodec::codecForName(name); return c ? c : defaultCodec; } } |