> For the Debian maintainers: Please reassign this bug to libid3-3.8.3c2a. > Unfortunately, id3lib is not actively maintained, but I will try to fix > the bug there and send a patch for id3lib.
Here is a patch for id3lib, it has to be applied after debian/patches/30-fix-utf16.patch because it modifies the same file. It just inserts a BOM before each string of a string list, so that a valid string list is written. --- diff -ru id3lib-3.8.3.orig/src/io_helpers.cpp id3lib-3.8.3/src/io_helpers.cpp --- id3lib-3.8.3.orig/src/io_helpers.cpp 2012-08-26 19:52:21.523825799 +0200 +++ id3lib-3.8.3/src/io_helpers.cpp 2012-08-26 19:53:02.060028394 +0200 @@ -373,10 +373,17 @@ //} // Right code unsigned char *pdata = (unsigned char *) data.c_str(); + unicode_t lastCh = BOM; for (size_t i = 0; i < size; i += 2) { unicode_t ch = (pdata[i] << 8) | pdata[i+1]; + if (lastCh == 0 && ch != BOM) + { + // Last character was NULL, so start next string with BOM. + writer.writeChars((const unsigned char*) &BOM, 2); + } writer.writeChars((const unsigned char*) &ch, 2); + lastCh = ch; } // End patch } --- Regards, Urs
diff -ru id3lib-3.8.3.orig/src/io_helpers.cpp id3lib-3.8.3/src/io_helpers.cpp --- id3lib-3.8.3.orig/src/io_helpers.cpp 2012-08-26 19:52:21.523825799 +0200 +++ id3lib-3.8.3/src/io_helpers.cpp 2012-08-26 19:53:02.060028394 +0200 @@ -373,10 +373,17 @@ //} // Right code unsigned char *pdata = (unsigned char *) data.c_str(); + unicode_t lastCh = BOM; for (size_t i = 0; i < size; i += 2) { unicode_t ch = (pdata[i] << 8) | pdata[i+1]; + if (lastCh == 0 && ch != BOM) + { + // Last character was NULL, so start next string with BOM. + writer.writeChars((const unsigned char*) &BOM, 2); + } writer.writeChars((const unsigned char*) &ch, 2); + lastCh = ch; } // End patch }