From: Manuel Nickschas Date: Wed, 4 Feb 2015 23:15:26 +0000 (+0100) Subject: Make UTF-8 the default encoding for QString and tr() X-Git-Tag: 0.12-beta1~39 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=92807744f2baf77c6b7048b236c44d807c725f48;hp=a83b00e50f8f27fbc17f3e3248d0d74c1e019252 Make UTF-8 the default encoding for QString and tr() As all our source files are in UTF-8 (and Qt5 even requires them to be), we can just tell Qt4 to treat them as that. So no need anymore to use QString::fromUtf8() for literals. This also makes it possible to use string literals in brace initializers for QString. --- diff --git a/src/common/main.cpp b/src/common/main.cpp index 48b45c28..9d87c4b8 100644 --- a/src/common/main.cpp +++ b/src/common/main.cpp @@ -20,6 +20,8 @@ #include +#include + #ifdef BUILD_CORE # include "coreapplication.h" #elif defined BUILD_QTUI @@ -55,6 +57,12 @@ Q_IMPORT_PLUGIN(qgif) int main(int argc, char **argv) { +#if QT_VERSION < 0x050000 + // All our source files are in UTF-8, and Qt5 even requires that + QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); +#endif + Quassel::setupBuildInfo(); QCoreApplication::setApplicationName(Quassel::buildInfo().applicationName); QCoreApplication::setApplicationVersion(Quassel::buildInfo().plainVersionString);