From 9a5490caab2be408d62896207af4de52cc22bfab Mon Sep 17 00:00:00 2001 From: mrexodia Date: Thu, 30 Mar 2017 23:48:36 +0200 Subject: [PATCH] UTF-8 as default QString codec (no more fromUtf8) --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 51a7a00b..9f7dad54 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,12 +1,20 @@ #include "mainwindow.h" #include "newfiledialog.h" #include +#include int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setApplicationVersion(APP_VERSION); + // Set QString codec to UTF-8 + QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); +#if QT_VERSION < QT_VERSION_CHECK(5,0,0) + QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); +#endif + NewFileDialog n; n.show(); return a.exec();