in reply to Problem upgrading XML::Fast from 0.11 to 0.17
This is wrong:
my $xml = do { local $/ = undef; open (my $fh, "<:encoding(ISO-8859-1)", $file) or die "Failed +to open $file - $!"; <$fh>; };
It should be:
my $xml = do { local $/ = undef; open (my $fh, "<:raw", $file) or die "Failed to open $file - $ +!"; <$fh>; };
XML files are binary files (parsing the document is required to determine the encoding), not text files (files where the encoding is external to the document). It is the parser's job to handle decoding.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Problem upgrading XML::Fast from 0.11 to 0.17
by ablanke (Monsignor) on Sep 22, 2017 at 19:26 UTC | |
by ikegami (Patriarch) on Sep 23, 2017 at 04:02 UTC | |
by ablanke (Monsignor) on Sep 23, 2017 at 09:52 UTC | |
by mje (Curate) on Sep 25, 2017 at 11:55 UTC | |
Re^2: Problem upgrading XML::Fast from 0.11 to 0.17
by mje (Curate) on Sep 25, 2017 at 11:53 UTC |
In Section
Seekers of Perl Wisdom