The recommendations by pcouderc are the usual ones, and I would actually code the script that way. But the fact is that when I run your script as originally posted and cat the output I get '<myxml fille="clémence"/>'. Have you looked at xml.out with 'hexdump -C'? If you see 'clémence' encoded as '63 6c c3 a9 6d 65 6e 63 65' it means your Perl output is correct. But if your command shell is set to interpret output as ISO Latin-1 you would get 'clÃ©mence' even if your script is doing the right thing.