in reply to Re^2: MP3::Tag encoding problem
in thread MP3::Tag encoding problem
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 $mp3 = MP3::Tag->new($t);
What you want as a human but no good for mkpath() et almy $tag_dir = "/music/$a_artist/$a_name";
ah, now this is mkpath()-ablemy $binary_tag_dir = encode_utf8($tag_dir);
Now, File::Find (properly) returns a binary string so needs decoding. Assuming your filesystem uses utf8 encoding:
At this point you can print and compare $char_file_find_dir and $tag_dir.my $char_file_find_dir = decode("utf8",$File::Find::dir);
You can also compare and do filename tests etc with $binary_tag_dir and $File::Find::dir.
When printing (including debugging) I had:
This tells perl that my terminal is utf8 aware and to print accented characters appropriately.binmode STDOUT, ":utf8";
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 ;)
|
|---|