mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
Ask Qt 4 to use the UTF-8 codec as the "codec for C strings"
Qt 5 does this by default, so it's not necessary there (in fact, setCodecForCStrings was removed, so you catch any mistakes). Now all QString methods taking a const char* or QByteArray (constructor, append(), operator+=, operator<, etc.) will interpret that char array as UTF-8. Conversely, the QByteArray methods taking a QString will generate UTF-8 too. This includes the badly named QString::fromAscii() and QString::toAscii(). Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
98027be1c1
commit
8da7a6985b
1 changed files with 10 additions and 0 deletions
10
qt-gui.cpp
10
qt-gui.cpp
|
@ -33,6 +33,7 @@
|
|||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
#include <QTextCodec>
|
||||
#include <QTranslator>
|
||||
|
||||
#if HAVE_OSM_GPS_MAP
|
||||
|
@ -1874,6 +1875,15 @@ void init_qt_ui(int *argcp, char ***argvp)
|
|||
void init_ui(int *argcp, char ***argvp)
|
||||
{
|
||||
application = new QApplication(*argcp, *argvp);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
// ask QString in Qt 4 to interpret all char* as UTF-8,
|
||||
// like Qt 5 does.
|
||||
// 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));
|
||||
#endif
|
||||
|
||||
GtkWidget *win;
|
||||
GtkWidget *nb_page;
|
||||
GtkWidget *dive_list;
|
||||
|
|
Loading…
Reference in a new issue