Bug 111246

Summary: UTF-8 tags saving/reading incorect
Product: [Applications] amarok Reporter: Tomas Simonaitis <haden>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: Foldus
Priority: NOR    
Version: 1.3   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Primitive fix

Description Tomas Simonaitis 2005-08-21 22:02:50 UTC
Version:           1.3 (using KDE KDE 3.3.2)
Installed from:    Compiled From Sources
OS:                Linux

Amarok should use UTF-8 when saving tags.
Currently it supplies UTF-8 string to taglib, yet it is saved as ISO-8859-1 and then read incorrectly 
(tag which is already in UTF-8 is reencoded when TStringToQString is used).

Reproducing:
Save tag with UTF-8 characters, re-add file to read them.
Comment 1 Tomas Simonaitis 2005-08-21 22:04:36 UTC
Created attachment 12308 [details]
Primitive fix

Scott Wheeler explains this problem in
http://bugs.kde.org/show_bug.cgi?id=111232.
Comment 2 Tomas Simonaitis 2005-08-21 22:06:27 UTC
Bug is about ID3v2 only.

Comment 3 Alexandre Oliveira 2005-08-24 04:41:29 UTC
Can you give us an example that shows this change working (ie: something that works with this patch, but doesn't work without it)? 
Comment 4 Tomas Simonaitis 2005-08-24 06:20:05 UTC
If locale is utf-8, put any extended characted into tag, save & close, remove file from playlist and then add it.
Tag will now show up wrongly (it's saved as iso-8859-1 thought data is utf-8).
With patch it will save tag correctly and work fine.

I've found this problem is discussed here too:
http://amarok.kde.org/component/option,com_simpleboard/Itemid,/func,view/catid,8/id,2869/#2869


Comment 5 Alexandre Oliveira 2005-09-01 23:17:44 UTC
*** Bug 111905 has been marked as a duplicate of this bug. ***
Comment 6 foldus 2005-09-02 01:23:51 UTC
The patch is partly working for me, but I must turn of recode to utf8 in settings
Comment 7 Alexandre Oliveira 2005-09-02 03:10:08 UTC
SVN commit 456056 by aoliveira:

Set utf-8 as default when writing id3v2 tags.
Thanks Tomas Simonaitis
BUG: 111246


 M  +4 -0      tagdialog.cpp  


--- trunk/extragear/multimedia/amarok/src/tagdialog.cpp #456055:456056
@@ -17,6 +17,7 @@
 #include <taglib/tag.h>
 #include <taglib/tfile.h>
 #include <taglib/tstring.h>
+#include <taglib/id3v2framefactory.h>
 
 #include <qfile.h>
 #include <qlabel.h>
@@ -606,6 +607,9 @@
 bool
 TagDialog::writeTag( MetaBundle mb, bool updateCB )
 {
+    //Set default codec to UTF-8 (see bugs 111246 and 111232)
+    TagLib::ID3v2::FrameFactory::instance()->setDefaultTextEncoding(TagLib::String::UTF8);
+
     QCString path = QFile::encodeName( mb.url().path() );
     if ( !TagLib::File::isWritable( path ) ) {
         amaroK::StatusBar::instance()->longMessage( i18n(