Use UTF8 explicitly rather than the local 8-bit codec

This commit is contained in:
David Sansome 2010-06-02 21:04:03 +00:00
parent 6dd32da591
commit 2381d2ba1a
1 changed files with 5 additions and 5 deletions

View File

@ -29,11 +29,11 @@ SongList M3UParser::Load(QIODevice* device, const QDir& dir) const {
M3UType type = STANDARD;
Metadata current_metadata;
QString line = QString::fromLocal8Bit(device->readLine()).trimmed();
QString line = QString::fromUtf8(device->readLine()).trimmed();
if (line.startsWith("#EXTM3U")) {
// This is in extended M3U format.
type = EXTENDED;
line = QString::fromLocal8Bit(device->readLine()).trimmed();
line = QString::fromUtf8(device->readLine()).trimmed();
}
forever {
@ -65,7 +65,7 @@ SongList M3UParser::Load(QIODevice* device, const QDir& dir) const {
if (device->atEnd()) {
break;
}
line = QString::fromLocal8Bit(device->readLine()).trimmed();
line = QString::fromUtf8(device->readLine()).trimmed();
}
return ret;
@ -101,8 +101,8 @@ void M3UParser::Save(const SongList &songs, QIODevice *device, const QDir &dir)
continue;
}
QString meta = QString("#EXTINF:%1,%2 - %3\n").arg(song.length()).arg(song.artist()).arg(song.title());
device->write(meta.toLocal8Bit());
device->write(MakeRelativeTo(song.filename(), dir).toLocal8Bit());
device->write(meta.toUtf8());
device->write(MakeRelativeTo(song.filename(), dir).toUtf8());
device->write("\n");
}
}