Fix support for iso8859-16 when compiling with ICU
ICU doesn't support iso8859-16, so we need to fall back to the Qt codec for this encoding. Task-number: QTBUG-45053 Change-Id: I9754cf098c906fe8a75363a3d090029543cd0e35 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
ba8c34aaf3
commit
124da60c1d
@ -3,6 +3,7 @@
|
||||
HEADERS += \
|
||||
codecs/qisciicodec_p.h \
|
||||
codecs/qlatincodec_p.h \
|
||||
codecs/qsimplecodec_p.h \
|
||||
codecs/qtextcodec_p.h \
|
||||
codecs/qtextcodec.h \
|
||||
codecs/qtsciicodec_p.h \
|
||||
@ -11,6 +12,7 @@ HEADERS += \
|
||||
SOURCES += \
|
||||
codecs/qisciicodec.cpp \
|
||||
codecs/qlatincodec.cpp \
|
||||
codecs/qsimplecodec.cpp \
|
||||
codecs/qtextcodec.cpp \
|
||||
codecs/qtsciicodec.cpp \
|
||||
codecs/qutfcodec.cpp
|
||||
@ -22,7 +24,6 @@ contains(QT_CONFIG,icu) {
|
||||
codecs/qicucodec.cpp
|
||||
} else {
|
||||
HEADERS += \
|
||||
codecs/qsimplecodec_p.h \
|
||||
codecs/qgb18030codec_p.h \
|
||||
codecs/qeucjpcodec_p.h \
|
||||
codecs/qjiscodec_p.h \
|
||||
@ -31,7 +32,6 @@ contains(QT_CONFIG,icu) {
|
||||
codecs/qbig5codec_p.h
|
||||
|
||||
SOURCES += \
|
||||
codecs/qsimplecodec.cpp \
|
||||
codecs/qgb18030codec.cpp \
|
||||
codecs/qjpunicode.cpp \
|
||||
codecs/qeucjpcodec.cpp \
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "qlatincodec_p.h"
|
||||
#include "qtsciicodec_p.h"
|
||||
#include "qisciicodec_p.h"
|
||||
#include "qsimplecodec_p.h"
|
||||
#include "private/qcoreglobaldata_p.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
@ -364,6 +365,8 @@ static QTextCodec *loadQtCodec(const char *name)
|
||||
return new QUtf32BECodec;
|
||||
if (!strcmp(name, "UTF-32LE"))
|
||||
return new QUtf32LECodec;
|
||||
if (!strcmp(name, "ISO-8859-16") || !strcmp(name, "latin10") || !strcmp(name, "iso-ir-226"))
|
||||
return new QSimpleTextCodec(13 /* == 8859-16*/);
|
||||
#ifndef QT_NO_CODECS
|
||||
if (!strcmp(name, "TSCII"))
|
||||
return new QTsciiCodec;
|
||||
|
@ -65,6 +65,7 @@ private slots:
|
||||
void aliasForUTF16() const;
|
||||
void mibForTSCII() const;
|
||||
void codecForTSCII() const;
|
||||
void iso8859_16() const;
|
||||
|
||||
void utf8Codec_data();
|
||||
void utf8Codec();
|
||||
@ -514,6 +515,13 @@ void tst_QTextCodec::codecForTSCII() const
|
||||
QCOMPARE(codec->mibEnum(), 2107);
|
||||
}
|
||||
|
||||
void tst_QTextCodec::iso8859_16() const
|
||||
{
|
||||
QTextCodec *codec = QTextCodec::codecForName("ISO8859-16");
|
||||
QVERIFY(codec);
|
||||
QCOMPARE(codec->name(), QByteArray("ISO-8859-16"));
|
||||
}
|
||||
|
||||
static QString fromInvalidUtf8Sequence(const QByteArray &ba)
|
||||
{
|
||||
return QString().fill(QChar::ReplacementCharacter, ba.size());
|
||||
|
Loading…
Reference in New Issue
Block a user