Set text codec to UTF8 fixing the handling of special characters

Set the encoding used by Qt to UTF8. This fixes the wrong appearance of
special characters caused by SQLite using UTF8 and the application
ISO-8859 or whatever.
This commit is contained in:
Martin Kleusberg
2013-01-05 14:48:13 +01:00
parent 9e2beb6c81
commit e7d213c546

View File

@@ -1,5 +1,6 @@
#include "MainWindow.h"
#include <QApplication>
#include <QTextCodec>
#if defined(Q_WS_MAC)
#include <Carbon/Carbon.h>
@@ -72,6 +73,12 @@ int main( int argc, char ** argv )
QApplication a( argc, argv );
a.setOrganizationName("sqlitebrowser");
a.setApplicationName("SQLite Database Browser " + QString(APP_VERSION));
// Set character encoding to UTF8
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
MainWindow w;
#if defined(Q_WS_MAC)
AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,