in reply to Re^2: MP3::Tag encoding problem
in thread MP3::Tag encoding problem

I've had a similar problem and for me the solution was to identify binary/character data and handle it appropriately.
my $mp3 = MP3::Tag->new($t);
The module returns a character string (Dec '08); so that's OK. Make sure any applications writing the tags encode properly. For linux, Easytag seems to work very well.
my $tag_dir = "/music/$a_artist/$a_name";
What you want as a human but no good for mkpath() et al
my $binary_tag_dir = encode_utf8($tag_dir);
ah, now this is mkpath()-able

Now, File::Find (properly) returns a binary string so needs decoding. Assuming your filesystem uses utf8 encoding:

my $char_file_find_dir = decode("utf8",$File::Find::dir);
At this point you can print and compare $char_file_find_dir and $tag_dir.

You can also compare and do filename tests etc with $binary_tag_dir and $File::Find::dir.

When printing (including debugging) I had:

binmode STDOUT, ":utf8";
This tells perl that my terminal is utf8 aware and to print accented characters appropriately.

You should also encode() the binary strings before printing them if you want to read them (or not if you want to 'od' them)

HTH

Corretcions welcome ;)