Package: id3v2
Version: 0.1.11-1.1
Followup-For: Bug #232307
The attached patch adds two new options to id3v2, '-u' will set
the string encoding to UTF16BE (id3v2 text encoding type 2), '-U'
will set the string encoding to UTF8 (id3v2 text encoding type 3).
Note that with only this patch by itself the two new options
won't work as id3lib is quite broken in this regard.
But at least it shouldn't break the existing behaviour and in
combination with an id3lib patch I'm currently preparing for
submission will allow real unicode tags to be written.
A basically working preview version of the id3lib patch is at
http://ranmachan.dyndns.org/~ranma/id3lib.unicode.20050708.patch
With it id3lib treats the strings as being in locale encoding by
default and will convert them to either iso-8859-1, utf-16 or utf-8
depending on which encoding is selected as desired by id3v2.
The reading function is also patched and will return the output in
locale encoding after the above patch.
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (990, 'unstable'), (500, 'hoary')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11.12-ac7-vs1.9.5-htbatm-imq
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Versions of packages id3v2 depends on:
ii libc6 2.3.2.ds1-22 GNU C Library: Shared libraries an
ii libgcc1 1:4.0.0-9 GCC support library
ii libid3-3.8.3 3.8.3-4.2 Library for manipulating ID3v1 and
ii libstdc++5 1:3.3.6-6 The GNU Standard C++ Library v3
ii zlib1g 1:1.2.2-4 compression library - runtime
id3v2 recommends no packages.
-- no debconf information
diff -Naru id3v2-0.1.11/id3v2.1 id3v2-0.1.11.patched/id3v2.1
--- id3v2-0.1.11/id3v2.1 2002-02-14 20:35:31.000000000 +0100
+++ id3v2-0.1.11.patched/id3v2.1 2005-07-08 17:02:13.000000000 +0200
@@ -44,6 +44,12 @@
.B \-C, \-\-convert
Converts id3v1 tag to id3v2
.TP
+.B \-u, \-\-utf16
+Use UTF16 encoding instead of iso-8859-1
+.TP
+.B \-U, \-\-utf8
+Use UTF8 encoding instead of iso-8859-1
+.TP
.B \-a, \-\-artist ARTIST
Set the artist information
.TP
diff -Naru id3v2-0.1.11/id3v2.cpp id3v2-0.1.11.patched/id3v2.cpp
--- id3v2-0.1.11/id3v2.cpp 2005-07-07 22:22:10.000000000 +0200
+++ id3v2-0.1.11.patched/id3v2.cpp 2005-07-08 17:05:05.000000000 +0200
@@ -40,6 +40,8 @@
std::cout << " -s, --delete-v1 Deletes id3v1 tags" << std::endl;
std::cout << " -D, --delete-all Deletes both id3v1 and id3v2 tags"
<< std::endl;
std::cout << " -C, --convert Converts id3v1 tag to id3v2" <<
std::endl;
+ std::cout << " -u, --utf16 Use UTF-16 encoding instead of
iso-8859-1" << std::endl;
+ std::cout << " -U, --utf8 Use UTF-8 encoding instead of
iso-8859-1" << std::endl;
std::cout << " -1, --id3v1-only Writes only id3v1 tag" <<
std::endl;
std::cout << " -2, --id3v2-only Writes only id3v2 tag" <<
std::endl;
std::cout << " -a, --artist \"ARTIST\" Set the artist information" <<
std::endl;
@@ -87,6 +89,7 @@
int iOpt;
int argCounter = 0;
int ii;
+ int id3te = ID3TE_ISO8859_1;
char tmp[TMPSIZE];
FILE * fp;
@@ -124,6 +127,8 @@
{ "convert", no_argument, &iLongOpt, 'C' },
{ "id3v1-only", no_argument, &iLongOpt, '1' },
{ "id3v2-only", no_argument, &iLongOpt, '2' },
+ { "utf16", no_argument, &iLongOpt, 'u' },
+ { "utf8", no_argument, &iLongOpt, 'U' },
// infomation to tag
{ "artist", required_argument, &iLongOpt, 'a' },
@@ -209,7 +214,7 @@
{ "WXXX", required_argument, &optFrameID, ID3FID_WWWUSER },
{ 0, 0, 0, 0 }
};
- iOpt = getopt_long (argc, argv, "12hfLvlRdsDCa:A:t:c:g:y:T:",
+ iOpt = getopt_long (argc, argv, "12hfLvlRdsuUDCa:A:t:c:g:y:T:",
long_options, &option_index);
if (iOpt == -1 && argCounter == 0)
@@ -240,6 +245,8 @@
case 'f': PrintFrameHelp(argv[0]);exit (0);
case 'L': PrintGenreList(); exit (0);
case 'v': PrintVersion(argv[0]); exit (0);
+ case 'u': id3te = ID3TE_UTF16BE; break;
+ case 'U': id3te = ID3TE_UTF8; break;
// listing / remove / convert -- see list.cpp and convert.cpp
case 'l': ListTag(argc, argv, optind, 0);
@@ -415,6 +422,7 @@
}
if (strlen(frameList[ii].data) > 0) {
myFrame->Field(ID3FN_TEXT) = frameList[ii].data;
+ myFrame->Field(ID3FN_TEXTENC) = id3te;
myTag.AttachFrame(myFrame);
}
break;
@@ -462,11 +470,13 @@
if (text == NULL)
{
myFrame->Field(ID3FN_TEXT) = frameList[ii].data;
+ myFrame->Field(ID3FN_TEXTENC) = id3te;
} else {
*text = '\0';
text++;
myFrame->Field(ID3FN_DESCRIPTION) = frameList[ii].data;
myFrame->Field(ID3FN_TEXT) = text;
+ myFrame->Field(ID3FN_TEXTENC) = id3te;
}
if (strlen(ID3_GetString(myFrame, ID3FN_TEXT)) > 0) {
myTag.AttachFrame(myFrame);
@@ -484,6 +494,7 @@
if (text == NULL)
{
myFrame->Field(ID3FN_TEXT) = frameList[ii].data;
+ myFrame->Field(ID3FN_TEXTENC) = id3te;
} else {
*text = '\0';
text++;
@@ -493,11 +504,13 @@
{
myFrame->Field(ID3FN_DESCRIPTION) = frameList[ii].data;
myFrame->Field(ID3FN_TEXT) = text;
+ myFrame->Field(ID3FN_TEXTENC) = id3te;
} else {
*lang = '\0';
lang++;
myFrame->Field(ID3FN_DESCRIPTION) = frameList[ii].data;
myFrame->Field(ID3FN_TEXT) = text;
+ myFrame->Field(ID3FN_TEXTENC) = id3te;
myFrame->Field(ID3FN_LANGUAGE) = lang;
}
}