http://qs321.pair.com?node_id=417807


in reply to Re: creating an XML string
in thread creating an XML string

Nasty :-)

It won't work if the argument to encode() is in LATIN-1, and your XML file is UTF-8.

update:... hmmmmmm it appears that the "most reasonable" approach would be simply

sub encode { my $arg = shift; $arg =~ s/&/&amp;/g $arg =~ s/</&lt;/g; $arg; }
and do the character encoding seperately using Encode, or let the filehandle figure it out.