Bug 135121

Summary: Strings encoded with UTF16BE in ID3v2 frames are not rendered correctly
Product: [Frameworks and Libraries] taglib Reporter: Urs Fleisch <ufleisch>
Component: generalAssignee: Scott Wheeler <wheeler>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Urs Fleisch 2006-10-04 23:06:28 UTC
Version:           1.4.0 (using KDE KDE 3.5.2)
Installed from:    Ubuntu Packages
Compiler:          gcc 4.0.3 
OS:                Linux

Reprodution:
Encode a string in an ID3v2 frame with UTF16BE, save the tag, read it again
and you will receive only strange characters.

Actually, the code for rendering UTF16BE does the same thing as for UTF16LE,
the two bytes should be swapped. The patch below fixes this:

diff -ru taglib.orig/taglib/toolkit/tstring.cpp taglib/taglib/toolkit/tstring.cpp
--- taglib.orig/taglib/toolkit/tstring.cpp	2006-09-29 05:52:42.000000000 +0200
+++ taglib/taglib/toolkit/tstring.cpp	2006-10-03 22:27:37.000000000 +0200
@@ -391,8 +391,8 @@
       char c1 = *it >> 8;
       char c2 = *it & 0xff;
 
-      v.append(c2);
       v.append(c1);
+      v.append(c2);
     }
     break;
   }
Comment 1 Scott Wheeler 2007-02-13 09:41:05 UTC
SVN commit 633110 by wheeler:

Fix the byte ordering for UTF16BE

BUG:135121


 M  +1 -1      tstring.cpp  


--- trunk/kdesupport/taglib/taglib/toolkit/tstring.cpp #633109:633110
@@ -391,8 +391,8 @@
       char c1 = *it >> 8;
       char c2 = *it & 0xff;
 
+      v.append(c1);
       v.append(c2);
-      v.append(c1);
     }
     break;
   }