From 9e4cc810686e4239f008e0ce3fb1cef5395b1e6e Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Wed, 29 Oct 2014 18:14:42 +0200 Subject: qt-qui.cpp: set the locale codec to UTF-8 on Win32 This makes QFile::encodeName() work and filenames with special chars on Win32 can be opened again. Fixes #740 Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- qt-gui.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qt-gui.cpp b/qt-gui.cpp index 94945cdbf..2f3e66bea 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -136,6 +136,12 @@ void init_ui(void) QFile::setDecodingFunction(decodeUtf8); QFile::setEncodingFunction(encodeUtf8); #endif +#else + // for Win32 and Qt5 we try to set the locale codec to UTF-8. + // this makes QFile::encodeName() work. +#ifdef Q_OS_WIN + QTextCodec::setCodecForLocale(QTextCodec::codecForMib(106)); +#endif #endif QCoreApplication::setOrganizationName("Subsurface"); QCoreApplication::setOrganizationDomain("subsurface.hohndel.org"); -- cgit v1.2.3-70-g09d2