From e4e1bbf4072b4d349d4e85feba349ba46a745ba3 Mon Sep 17 00:00:00 2001 From: "craig.p.drummond@gmail.com" Date: Mon, 15 Oct 2012 11:11:55 +0000 Subject: [PATCH] Handle UTF-8 playlist names. BUG:109 --- ChangeLog | 1 + mpd/mpdparseutils.cpp | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1be96a46c..72573af38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,6 +62,7 @@ Phonon backends seem to work reliably, and there can be delays between pressing a button (e.g. start) and the action occuring (due to buffering?). To re-enable pass -DDENABLE_PHONON=ON to cmake. +36. Handle UTF-8 playlist names. 0.8.3.1 ------- diff --git a/mpd/mpdparseutils.cpp b/mpd/mpdparseutils.cpp index 965cdfb0c..98df45b6e 100644 --- a/mpd/mpdparseutils.cpp +++ b/mpd/mpdparseutils.cpp @@ -51,16 +51,15 @@ QList MPDParseUtils::parsePlaylists(const QByteArray &data) { QList playlists; QList lines = data.split('\n'); - QList tokens; int amountOfLines = lines.size(); for (int i = 0; i < amountOfLines; i++) { - tokens = lines.at(i).split(':'); + QList tokens = lines.at(i).split(':'); if (tokens.at(0) == "playlist") { Playlist playlist; - playlist.name = tokens.at(1).simplified(); + playlist.name = QString::fromUtf8(tokens.at(1)).simplified(); i++; tokens = lines.at(i).split(':'); @@ -398,7 +397,6 @@ MusicLibraryItemRoot * MPDParseUtils::parseLibraryItems(const QByteArray &data) DirViewItemRoot * MPDParseUtils::parseDirViewItems(const QByteArray &data) { QList lines = data.split('\n'); - DirViewItemRoot * rootItem = new DirViewItemRoot; DirViewItem * currentDir = rootItem; QStringList currentDirList;