summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-03-25 19:33:07 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-03-27 11:08:32 (GMT)
commit811eb47c3501479033ac3a484beeb896b6c0753f (patch)
tree6d631c9dfe0e0056b8e16ce5d23a8992f41decd5
parent6ac130466400197b8977f60d14ed96abfb0d2172 (diff)
downloadQt-811eb47c3501479033ac3a484beeb896b6c0753f.zip
Qt-811eb47c3501479033ac3a484beeb896b6c0753f.tar.gz
Qt-811eb47c3501479033ac3a484beeb896b6c0753f.tar.bz2
avoid empty codec name
-rw-r--r--tools/linguist/shared/translator.cpp2
-rw-r--r--tools/linguist/shared/ts.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp
index 6ae8059..32404a5 100644
--- a/tools/linguist/shared/translator.cpp
+++ b/tools/linguist/shared/translator.cpp
@@ -545,7 +545,7 @@ void Translator::setCodecName(const QByteArray &name)
if (!codec) {
if (!name.isEmpty())
qWarning("No QTextCodec for %s available. Using Latin1\n", name.constData());
- m_codecName.clear();
+ m_codecName = "ISO-8859-1";
} else {
m_codecName = codec->name();
}
diff --git a/tools/linguist/shared/ts.cpp b/tools/linguist/shared/ts.cpp
index d454e4e..3af9e59 100644
--- a/tools/linguist/shared/ts.cpp
+++ b/tools/linguist/shared/ts.cpp
@@ -277,7 +277,9 @@ bool TSReader::read(Translator &translator)
// ignore these, just whitespace
} else if (elementStarts(strdefaultcodec)) {
// <defaultcodec>
- translator.setCodecName(readElementText().toLatin1());
+ const QString &codec = readElementText();
+ if (!codec.isEmpty())
+ translator.setCodecName(codec.toLatin1());
// </defaultcodec>
} else if (isStartElement()
&& name().toString().startsWith(strextrans)) {