SheridanCat has asked for the wisdom of the Perl Monks concerning the following question:
Here's the code I'm testing:<?xml version='1.0' encoding='ISO-8859-1'?> <data> <title>Más Y Más</title> <artist>La Unión</artist> </data>
I pass the data file to the script and the output is this:#!/usr/bin/perl use warnings; use strict; use XML::Simple; use Data::Dumper; undef $/; open( FH, shift ); my $raw_file = <FH>; my $xml = XMLin( $raw_file, forcearray => [], suppressempty => undef ); print Dumper ( $xml ); print $xml->{'artist'}; print "\n";
$VAR1 = { 'artist' => "La Uni\x{f3}n", 'title' => "M\x{e1}s Y M\x{e1}s" };
La Uni≤nSo, the dumped data at least has the hex equivalents of the non-English characters in it. The print, however, has done some conversion that I'm not sure about. In any event, this ends up as pretty much junk data. I'm sure there's a simple conversion I'm missing here. I've butted my head up against Unicode::String for awhile, but the results were never satisfactory.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Character Conversion Conundrum
by Aristotle (Chancellor) on Dec 22, 2004 at 22:04 UTC | |
by Joost (Canon) on Dec 22, 2004 at 22:38 UTC | |
by Aristotle (Chancellor) on Dec 22, 2004 at 22:46 UTC | |
by Joost (Canon) on Dec 22, 2004 at 22:59 UTC | |
by Aristotle (Chancellor) on Dec 22, 2004 at 23:17 UTC | |
| |
by SheridanCat (Pilgrim) on Dec 23, 2004 at 17:28 UTC | |
by Aristotle (Chancellor) on Dec 23, 2004 at 19:17 UTC | |
by SheridanCat (Pilgrim) on Dec 28, 2004 at 20:01 UTC |