From 39752345660225837bf3a29631fd305d0e21f8bb Mon Sep 17 00:00:00 2001 From: David Sansome Date: Tue, 23 Feb 2010 14:52:22 +0000 Subject: [PATCH] Write UTF-8 tags properly --- src/song.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/song.cpp b/src/song.cpp index e47431a9e..7212b085b 100644 --- a/src/song.cpp +++ b/src/song.cpp @@ -327,15 +327,19 @@ bool Song::Save() const { if (d->filename_.isNull()) return false; +# define str(x) TagLib::String(x.toUtf8().constData(), TagLib::String::UTF8) + TagLib::FileRef ref(QFile::encodeName(d->filename_).constData()); - ref.tag()->setTitle(d->title_.toUtf8().constData()); - ref.tag()->setArtist(d->artist_.toUtf8().constData()); - ref.tag()->setAlbum(d->album_.toUtf8().constData()); - ref.tag()->setGenre(d->genre_.toUtf8().constData()); - ref.tag()->setComment(d->comment_.toUtf8().constData()); + ref.tag()->setTitle(str(d->title_)); + ref.tag()->setArtist(str(d->artist_)); + ref.tag()->setAlbum(str(d->album_)); + ref.tag()->setGenre(str(d->genre_)); + ref.tag()->setComment(str(d->comment_)); ref.tag()->setYear(d->year_); ref.tag()->setTrack(d->track_); +# undef str + bool ret = ref.save(); #ifdef Q_OS_LINUX if (ret) {