From 92807744f2baf77c6b7048b236c44d807c725f48 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 5 Feb 2015 00:15:26 +0100 Subject: [PATCH] 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. --- src/common/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.20.1