diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 1056d0a0..1afe2468 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -543,44 +543,44 @@ CueSheetModel - + No. - + File / Track - + Index - + Duration - + File %1 - + Track %1 - - + + Unknown Artist - - + + Unknown Title diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts index 88a0a4b3..bad301a5 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -543,44 +543,44 @@ CueSheetModel - + No. Numer. - + File / Track Plik/ŚcieżKa - + Index Indeks - + Duration Czas trwania - + File %1 Plik %1 - + Track %1 Ścieżka %1 - - + + Unknown Artist Nieznany Artysta - - + + Unknown Title Nieznany Tytuł diff --git a/src/Config.h b/src/Config.h index 444465b4..ac9fcc07 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_PATCH 7 -#define VER_LAMEXP_BUILD 803 +#define VER_LAMEXP_BUILD 804 /////////////////////////////////////////////////////////////////////////////// // Tool versions (minimum expected versions!) diff --git a/src/Model_CueSheet.cpp b/src/Model_CueSheet.cpp index 9bdfbbff..97fe50dd 100644 --- a/src/Model_CueSheet.cpp +++ b/src/Model_CueSheet.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -557,6 +558,9 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic return 2; } + //Get system local Codec + const QTextCodec *codec = QTextCodec::codecForName("System"); + //Check for UTF-8 BOM in order to guess encoding bool bUTF8 = false, bForceLatin1 = false; QByteArray bomCheck = cueFile.peek(128); @@ -569,7 +573,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic { const QString replacementSymbol = QString(QChar(QChar::ReplacementCharacter)); QByteArray data = cueFile.peek(1048576); - if((!data.isEmpty()) && QString::fromLocal8Bit(data.constData(), data.size()).contains(replacementSymbol)) + if((!data.isEmpty()) && codec->toUnicode(data.constData(), data.size()).contains(replacementSymbol)) { qWarning("Decoding error using local 8-Bit codepage. Enforcing Latin-1."); bForceLatin1 = true; @@ -611,7 +615,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic break; } - QString line = bUTF8 ? QString::fromUtf8(lineData.constData(), lineData.size()).trimmed() : (bForceLatin1 ? QString::fromLatin1(lineData.constData(), lineData.size()).trimmed() : QString::fromLocal8Bit(lineData.constData(), lineData.size()).trimmed()); + QString line = (bUTF8 ? QString::fromUtf8(lineData.constData(), lineData.size()) : (bForceLatin1 ? QString::fromLatin1(lineData.constData(), lineData.size()) : codec->toUnicode(lineData.constData(), lineData.size()))).trimmed(); /* --- FILE --- */ if(rxFile.indexIn(line) >= 0) diff --git a/src/PlaylistImporter.cpp b/src/PlaylistImporter.cpp index 9b58405d..3e4e768d 100644 --- a/src/PlaylistImporter.cpp +++ b/src/PlaylistImporter.cpp @@ -29,6 +29,7 @@ #include #include #include +#include //Un-escape XML characters static const struct @@ -133,6 +134,8 @@ bool PlaylistImporter::parsePlaylist_m3u(QFile &data, QStringList &fileList, con { QByteArray line = data.readLine(); const bool preferUTF8 = data.fileName().endsWith(".m3u8", Qt::CaseInsensitive); + const QTextCodec *codec = QTextCodec::codecForName("System"); + while(line.size() > 0) { @@ -141,12 +144,12 @@ bool PlaylistImporter::parsePlaylist_m3u(QFile &data, QStringList &fileList, con if(preferUTF8) { filePath[0] = QString(QDir::fromNativeSeparators(QString::fromUtf8(line.constData(), line.size()).trimmed())); - filePath[1] = QString(QDir::fromNativeSeparators(QString::fromLocal8Bit(line.constData(), line.size()).trimmed())); + filePath[1] = QString(QDir::fromNativeSeparators(codec->toUnicode(line.constData(), line.size()).trimmed())); filePath[2] = QString(QDir::fromNativeSeparators(QString::fromLatin1(line.constData(), line.size()).trimmed())); } else { - filePath[0] = QString(QDir::fromNativeSeparators(QString::fromLocal8Bit(line.constData(), line.size()).trimmed())); + filePath[0] = QString(QDir::fromNativeSeparators(codec->toUnicode(line.constData(), line.size()).trimmed())); filePath[1] = QString(QDir::fromNativeSeparators(QString::fromLatin1(line.constData(), line.size()).trimmed())); filePath[2] = QString(QDir::fromNativeSeparators(QString::fromUtf8(line.constData(), line.size()).trimmed())); } @@ -179,16 +182,17 @@ bool PlaylistImporter::parsePlaylist_m3u(QFile &data, QStringList &fileList, con bool PlaylistImporter::parsePlaylist_pls(QFile &data, QStringList &fileList, const QDir &baseDir, const QDir &rootDir) { QRegExp plsEntry("File(\\d+)=(.+)", Qt::CaseInsensitive); + const QTextCodec *codec = QTextCodec::codecForName("System"); QByteArray line = data.readLine(); while(line.size() > 0) { QString filePath[3]; - filePath[0] = QString(QDir::fromNativeSeparators(QString::fromLocal8Bit(line.constData(), line.size()).trimmed())); - filePath[2] = QString(QDir::fromNativeSeparators(QString::fromLatin1(line.constData(), line.size()).trimmed())); - filePath[1] = QString(QDir::fromNativeSeparators(QString::fromUtf8(line.constData(), line.size()).trimmed())); - + filePath[0] = QString(QDir::fromNativeSeparators(codec->toUnicode(line.constData(), line.size()).trimmed())); + filePath[1] = QString(QDir::fromNativeSeparators(QString::fromLatin1(line.constData(), line.size()).trimmed())); + filePath[2] = QString(QDir::fromNativeSeparators(QString::fromUtf8(line.constData(), line.size()).trimmed())); + for(size_t i = 0; i < 3; i++) { if(!filePath[i].contains(QChar(QChar::ReplacementCharacter)))