How about using Unicode::Map?
With it, you can convert the input from utf-8 to utf-16, then perform the XMLin call, and then convert back to utf-8 afterwards (if need be).
For example:
use strict; use warnings; use Unicode::Map(); use XML::Simple; my $string = '<eleve nom="qsdqsd" prenom="Raphaël" classe="Seconde L" +adresse="Léon Bourgain" code_postal="3423" ville="machin" pays="Franc +e" telephone="3421434" />'; # Convert to utf-16 my $map = new Unicode::Map("ISO-8859-1"); my $utf16 = $map->to_unicode($string); # Recommended to call XMLin using 'eval', to trap errors my $ref = eval { XMLin($utf16) }; $@ and die "An error occurred in XMLin: '$@'\n"; # Now you can use '$ref' ... my $out = XMLout($ref); print "XMLout => '$out'\n";
If necessary, when you use the resulting "$ref", you can convert it back to utf-8 with the from_unicode() method of Unicode::Map.
In reply to Re: XML::Simple and encoding
by liverpole
in thread XML::Simple and encoding
by Girzi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |