IssuéTést
####
#!/usr/bin/perl -w
use XML::DOM;
use Encode;
use open OUT => ":utf8";
use open ":std";
my $XmlParserObj = XML::DOM::Parser->new();
open(IN,"<:utf8","in.xml");
my @in = ;
my $inStr = join("",@in);
#$inStr = encode("utf8",$inStr); # redundant if I use <:utf8 in open
#$inStr = decode("utf8",$inStr); # make all tested strings get "?" instead of latin chars
my $doc = $XmlParserObj->parse($inStr);
my $value = $doc->getElementsByTagName("Name")->item(0)->getChildNodes()->item(0)->getData();
my $str = $doc->toString();
#binmode(STDOUT,":utf8"); # redundant
print "is input utf8 ? ",Encode::is_utf8($inStr),"\n";
print "Input:\n".$inStr;
print "is value utf8 ? ",Encode::is_utf8($value),"\n";
print "Value: ".$value."\n";
print "is output utf8 ? ",Encode::is_utf8($str),"\n";
print "Output:\n".$str;
exit(0);
##
##
is input utf8 ? 1
Input:
IssuéTést
is value utf8 ? 1
Value: IssuéTést
is output utf8 ? 1
Output:
Issu㩔st