From 0182e86569c11f714b092c5f53d7632110df448b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 5 Mar 2021 21:46:27 +0100 Subject: [PATCH] GUI: mux: convert QString to std::filesystem::path properly This is in the code path used for querying the user for a file name to save to, e.g. when browsing for the destination file in the multiplexer or when saving an attachment in the header editor. Fixes #3049. --- NEWS.md | 4 ++++ src/mkvtoolnix-gui/util/file_dialog.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 32255579d..4101f6db5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -32,6 +32,10 @@ copy action, no matter which keys were pressed by the users. This prevents Windows Explorer from deleting the dragged file when the user presses shift while dropping the file onto MKVToolNix GUI. +* MKVToolNix GUI, only on Windows: when using the file dialog for selecting a + file name to save to (e.g. when browsing for the destination file name in + the multiplexer or saving an attachment in the header editor) non-ASCII + characters in the default file name were mangled. Fixes #3049. ## Other changes diff --git a/src/mkvtoolnix-gui/util/file_dialog.cpp b/src/mkvtoolnix-gui/util/file_dialog.cpp index 13f79d903..edcc09e85 100644 --- a/src/mkvtoolnix-gui/util/file_dialog.cpp +++ b/src/mkvtoolnix-gui/util/file_dialog.cpp @@ -88,7 +88,7 @@ getSaveFileName(QWidget *parent, QFileDialog::Options options) { auto defaultName = sanitizeDirectory(dir, true); if (!defaultFileName.isEmpty()) - defaultName = QDir::toNativeSeparators(Q((mtx::fs::to_path(to_utf8(dir)) / to_utf8(defaultFileName)).u8string())); + defaultName = QDir::toNativeSeparators(Q((mtx::fs::to_path(to_utf8(dir)) / mtx::fs::to_path(to_utf8(defaultFileName))).u8string())); auto result = QDir::toNativeSeparators(QFileDialog::getSaveFileName(parent, caption, defaultName, filter, selectedFilter, options & QFileDialog::DontUseCustomDirectoryIcons));