1

I have a perl script that is processing an XML file generated by iTunes, builds playlists and prints them to a text file. It loads as follows:

my $doc = XML::LibXML->load_xml( location => $source )

The output goes to a txt file using utf8, as follows:

use strict;
use warnings;
use feature 'unicode_strings';
use HTML::Entities;
use XML::LibXML qw( );
use Getopt::Long qw(GetOptions);
use URI::Escape;
use File::Spec;
use File::Basename;
use File::Spec;
use utf8;
open(m3uHandle, "+>", $path)
    or die $! ? "Error opening: $path $!"
     : "Exit status $?";
binmode (m3uHandle, ":utf8");

It seems that unicode characters that are not being processed correctly, assuming I am doing this correctly.

The following is from the XML file:

Locationfile:///Users/johnprokopek/Music/iTunes%20Classical/iTunes%20Media/Music/Jacqueline%20Du%20Pre%CC%81/The%20Complete%20EMI%20Recordings%20%5BDisc%203%5D/3-01%20Monn_%20Chello%20Cncerto%20in%20G%20minor.mp3

The substring of interest in the input is:

Pre%CC%81

The output for that after cleaning up the path is as follows (ignore the misspellings, they were direct from the music file):

Music\Jacqueline Du PreÌ\The Complete EMI Recordings [Disc 3]\3-01 Monn_ Chello Cncerto in G minor.mp3

The problem with the output is the PreÌ , it should be Pré.

So, what am I missing or should I try? thanks, john

Coltrane58
  • 317
  • 1
  • 4

0 Answers0