use Encode qw( decode );
my $twig=XML::Twig->new(pretty_print => 'indented');
$twig->parse( '<?xml version="1.0" encoding="UTF-8"?><myxml/>');
my $root= $twig->root;
$root->set_att( 'fille' => decode('UTF-8', 'clémence') );
open(PF, ">", "out.xml") or die "can't open file $!\n";
Thank you all for your help.
My conclusions are:
- utf8 is not so generalized that I did hope, certainly for 2 reasons, the weight of the past and all lines of code soon written. And certainly too because it is more a problem for non speaking english people.
- there is not default utf8 at global perl level (and it could be dangerous)
- an excellent default at scope level, and then at script level is: