From c54786e22cadd7e32a51f7ae1d5eb7e073cefded Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sat, 11 Jan 2020 16:18:58 +0100 Subject: [PATCH] Windows: when using a Qt file dialog, convert to utf-8 not local8bit. Could not used a non-ascii topdir before the change --- src/qtgui/confgui/confgui.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/qtgui/confgui/confgui.cpp b/src/qtgui/confgui/confgui.cpp index 8a2082b4..03b9b918 100644 --- a/src/qtgui/confgui/confgui.cpp +++ b/src/qtgui/confgui/confgui.cpp @@ -727,12 +727,18 @@ string ConfParamSLW::listToString() { vector ls; for (int i = 0; i < m_lb->count(); i++) { - // General parameters are encoded as utf-8. File names as - // local8bit There is no hope for 8bit file names anyway - // except for luck: the original encoding is unknown. + // General parameters are encoded as utf-8. + // Linux file names as local8bit There is no hope for 8bit + // file names anyway except for luck: the original encoding is + // unknown. In most modern configs, local8Bits will be UTF-8. + // Except on Windows: we store file names as UTF-8 QString text = m_lb->item(i)->text(); if (m_fsencoding) { +#ifdef _WIN32 + ls.push_back((const char *)(text.toUtf8())); +#else ls.push_back((const char *)(text.toLocal8Bit())); +#endif } else { ls.push_back((const char *)(text.toUtf8())); }