jfrm has asked for the wisdom of the Perl Monks concerning the following question:
I have been uploading an XML file to a service provider for a long time with the first line output as:
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:$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");
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.$cureq .= '<?xml version="1.0" encoding="UTF-8"?>'."\n"; open (XML, '>:encoding(UTF-8)', $xmlfile) or return("Could not open $x +mlfile");
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Encoding horridness
by choroba (Cardinal) on Jul 12, 2017 at 13:07 UTC | |
by Anonymous Monk on Jul 12, 2017 at 13:57 UTC | |
by choroba (Cardinal) on Jul 12, 2017 at 14:00 UTC | |
by Anonymous Monk on Jul 12, 2017 at 14:18 UTC | |
Re: Encoding horridness
by Corion (Patriarch) on Jul 12, 2017 at 13:10 UTC | |
by Anonymous Monk on Jul 12, 2017 at 14:07 UTC | |
by Corion (Patriarch) on Jul 12, 2017 at 14:20 UTC | |
by Anonymous Monk on Jul 12, 2017 at 14:26 UTC | |
by choroba (Cardinal) on Jul 12, 2017 at 16:51 UTC | |
| |
by hippo (Bishop) on Jul 12, 2017 at 14:16 UTC | |
by Anonymous Monk on Jul 12, 2017 at 14:20 UTC | |
Re: Encoding horridness
by runrig (Abbot) on Jul 12, 2017 at 17:58 UTC | |
by jfrm (Monk) on Jul 16, 2017 at 09:02 UTC | |
by hippo (Bishop) on Jul 16, 2017 at 09:56 UTC | |
Re: Encoding horridness
by karlgoethebier (Abbot) on Jul 12, 2017 at 17:24 UTC | |
by Corion (Patriarch) on Jul 12, 2017 at 17:33 UTC | |
by karlgoethebier (Abbot) on Jul 12, 2017 at 18:20 UTC | |
Re: Encoding horridness
by Anonymous Monk on Jul 12, 2017 at 14:06 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |
Back to
Seekers of Perl Wisdom