summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2014-10-29 18:14:42 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-29 09:28:11 -0700
commit9e4cc810686e4239f008e0ce3fb1cef5395b1e6e (patch)
tree59b5ddaa7d67c57a045d7c8754328c711cb206a0
parent3b5781508cba30673bbabac2ef93c2632f4872fb (diff)
downloadsubsurface-9e4cc810686e4239f008e0ce3fb1cef5395b1e6e.tar.gz
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 <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-gui.cpp6
1 files changed, 6 insertions, 0 deletions
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");