jeffreyray has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am using pp to package a command line program to edit mp3 tags. My program works fine before I package it, but I get this error after packaging as an exe:

Unknown encoding 'UTF-16' at MP3/Tag/ID3v2.pm line 2261  

The when I use pp to create a .par file, utf8.pm is included. I don't believe there is a utf16.pm. Does anyone know what files I need to include to to handle UTF16.

Here is the code the produces the error:

@data{@tag_names} = MP3::Tag->new($file)->autoinfo();
Thank you greatly.

Replies are listed 'Best First'.
Re: packaging programs than can handle UTF-16
by moritz (Cardinal) on Dec 13, 2009 at 19:48 UTC

    Probably Encode.pm loads another module for handling UTF-16.

    $ perl -le 'binmode STDIN, ":encoding(utf-16)"; print join " ", keys % +INC' bytes.pm warnings/register.pm XSLoader.pm Encode/Alias.pm Exporter.pm +vars.pm strict.pm PerlIO/encoding.pm Encode/Unicode.pm Encode/Config. +pm Encode/Encoding.pm PerlIO.pm warnings.pm Encode.pm base.pm

    Try to include those modules in your executable, maybe it works then?

Re: packaging programs than can handle UTF-16
by Khen1950fx (Canon) on Dec 13, 2009 at 21:52 UTC
    In the examples folder in the source, you'll find a program to edit tags: mp3info2. Give it a try.

    Another thing that you could try is:

    if (exists $mp3->{ID3v2}) { # read some information from the tag ($name, $info) = $mp3->{ID3v2}->get_frame("TIT2"); # delete the tag completely from the file $mp3->{ID3v2}->remove_tag; } else { # create a new tag $mp3->new_tag("ID3v2"); $mp3->{ID3v2}->add_frame("TALB", 0, "Album title"); $mp3->write_tag; } $mp3->close();

    You can add 0 to add_frame to put it in plain ascii. I haven't tested it yet. Hope it helps:-).