Bug 135121 - Strings encoded with UTF16BE in ID3v2 frames are not rendered correctly
Summary: Strings encoded with UTF16BE in ID3v2 frames are not rendered correctly
Status: RESOLVED FIXED
Alias: None
Product: taglib
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-04 23:06 UTC by Urs Fleisch
Modified: 2007-02-13 09:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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;
   }