From ff1d7b9e28dfeaf3462a6731e8439eaafabf9522 Mon Sep 17 00:00:00 2001 From: Joern Date: Fri, 5 Feb 2016 17:54:03 +0100 Subject: [PATCH] Fix Media Library / non-standard ASCII characters for VLC player ... video not shown when path contains non-standard chars --- src/VideoWindow.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/VideoWindow.cpp b/src/VideoWindow.cpp index 191f0cd92..43fa65ffd 100644 --- a/src/VideoWindow.cpp +++ b/src/VideoWindow.cpp @@ -484,16 +484,17 @@ void VideoWindow::mediaSelected(QString filename) if (filename.endsWith("/DVD") || (filename != "" && QFile(filename).exists())) { + // properly encode the filename as URL (with all special characters) + filename = QUrl::toPercentEncoding(filename, "/\\", ""); #ifdef Q_OS_LINUX - QString fileURL = "file://" + filename.replace(" ","%20").replace("\\", "/"); + QString fileURL = "file://" + filename.replace("\\", "/"); #else // A Windows "c:\xyz\abc def.avi" filename should become file:///c:/xyz/abc%20def.avi - QString fileURL = "file:///" + filename.replace(" ","%20").replace("\\", "/"); -#endif + QString fileURL = "file:///" + filename.replace("\\", "/"); +#endif //qDebug()<<"file url="<