Skip Menu |

This queue is for tickets about the Audio-TagLib CPAN distribution.

Report information
The Basics
Id: 25401
Status: resolved
Priority: 0/
Queue: Audio-TagLib

People
Owner: Nobody in particular
Requestors: daxim [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.43
Fixed in: 1.62



Audio-TagLib-1.43 perl v5.8.8 built for i586-linux-thread-multi Linux 2.6.18.8-0.1-default #1 SMP Fri Mar 2 13:51:59 UTC 2007 i686 athlon i386 GNU/Linux Audio::TagLib::String does something horrible to strings which have the UTF8 flag set. See the attached test case, the album tag is ruined after it's written out to file.
Subject: audio-taglib.t
#!/usr/bin/perl use strict; use diagnostics; use Audio::TagLib qw(); use Devel::Peek qw(Dump); use Test::More tests => 2; sub setalbum { my $fname = shift; my $str = shift; my $f = Audio::TagLib::FileRef->new($fname); $f->tag->setAlbum(Audio::TagLib::String->new($str)); $f->save; }; sub getalbum{ my $fname = shift; return Audio::TagLib::FileRef->new($fname)->tag->album->toCString; }; # -- my $fname = '01.mp3'; for ( '123', "\x{4e00}\x{4e8c}\x{4e09}", # yi'ersan ) { diag Dump $_; setalbum $fname, $_; ok getalbum($fname) eq $_; };
Hi, This is actually a known bug of taglib library. See http://66.92.20.25/?l=taglib-devel&m=111766499227098&w=2 The string marshalling goes fine between perl and TagLib::String CXX class. To prove please have a look at t/TabLib_String.t and run. Thanks. -dongxu
Subject: possible fix
please patch the diff. - dongxu
--- audio-taglib.t 2007-03-15 22:08:47.000000000 +0800 +++ audio-taglib_new.t 2007-03-15 22:04:13.000000000 +0800 @@ -16,11 +16,17 @@ sub getalbum{ my $fname = shift; - return Audio::TagLib::FileRef->new($fname)->tag->album->toCString; + my $i = Audio::TagLib::ID3v2::FrameFactory->instance(); + $i->setDefaultTextEncoding("UTF8"); + my $f = Audio::TagLib::MPEG::File->new($fname); + $f->setID3v2FrameFactory($i); + my $a = $f->tag->album; + return $a->toCString(1); }; # -- +binmode(STDOUT, ":utf8"); my $fname = '01.mp3'; for ( '123',
Subject: ticket closed
Hi, ID3 tag is the most difficult part to handle since there are various spec versions. The patch is ugly, but can work around;-) - dongxu