Tell Qt4 that we really meant Utf8 when we said Utf8

How strange. Telling Qt4 to assume that all C strings are Utf8 apparently
isn't enough to convince tr() that the C strings we pass to it are Utf8.
You need to set that codec separately.

Fixes #503

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-04-30 10:37:55 -07:00
parent 084c2c04db
commit 7797926329

View file

@ -89,6 +89,9 @@ void init_ui(void)
// 106 is "UTF-8", this is faster than lookup by name
// [http://www.iana.org/assignments/character-sets/character-sets.xml]
QTextCodec::setCodecForCStrings(QTextCodec::codecForMib(106));
// and for reasons I can't understand, I need to do the same again for tr
// even though that clearly uses C strings as well...
QTextCodec::setCodecForTr(QTextCodec::codecForMib(106));
#ifdef Q_OS_WIN
QFile::setDecodingFunction(decodeUtf8);
QFile::setEncodingFunction(encodeUtf8);