It is very simple to break XML::LibXML, simply use latin1 characters above 127, as used in most European languages. I suspect that the library is using old interfaces to Perl's unicode support, or simplifying life a too much. The attached file will demonstrate the problems (same results for perl5.8.7 and perl5.10.0) Is libxml2 pure utf8? Then, each string parameter which is passed in by the user should call encode("utf8", $string); Also, $xml->toString() should set binmode on the output file temporarily to ":encoding(charset)", where charset is defined with the document creation. Changing the interface a little bit in this respect is without consequences: the current behavior is very broken, as the attachment demonstrates.
Message body not shown because it is not plain text.