perlquestion
jfrm
I have been uploading an XML file to a service provider for a long time with the first line output as:
<code>
$cureq .= '<?xml version="1.0" encoding="latin1"?>'."\n";
$cureq .= # lots of other xml stuff
open (XML, ">$xmlfile") or return("Could not open $xmlfile");
print $cureq;
close XML or return("Could not close $xmlfile");
</code>
Now I have to change the encoding from latin1 to UTF-8 and having read around quite a lot now, I realise that I just don't get it. I have tried changing what I thought were the critical 2 lines viz:
<code>
$cureq .= '<?xml version="1.0" encoding="UTF-8"?>'."\n";
open (XML, '>:encoding(UTF-8)', $xmlfile) or return("Could not open $xmlfile");
</code>
This creates the file but my service provider now returns 'Invalid XML'. I just don't get it and what's more I cannot think of a way to debug it or investigate more deeply.
Any clues for this poor padawan would be appreciated.