Something doesn't work with XML encoding
Posted: Tue Sep 16, 2014 11:09 pm
This code should "copy" files (with minor changes, maybe - spaces, EOLs etc). Instead, it changes the way the Polish characters are represented:
GPX=LoadXML(#PB_Any,"GPSdata_in.gpx",#PB_UTF8)
SaveXML(GPX,"GPSdata_out.gpx")
Of course the file GPSdata_in.gpx is a valid XML document (created by the GPS unit or GPS software) with the UTF-8 encoding. 2 GPS devices and at least 3 different programs (English language ones) understand those Polish characters correctly.
I have found one way to keep them intact: Load the XML as it was in #PB_Ascii encoding. But after saving it changes the XML header (to "ISO-8859-1"), thus the GPS device reads such a file misinterpreting characters...If you manually change the XML header in the file created this way back to "UTF-8", everything is OK.
Same messy problems with the creation of XML (CreateXML(...) command). Polish characters from the text fields are encoded the wrong way.
And additionally, to make things even worse, the text fields read from the XML are displayed the wrong way on the screen (always, both when the XML was loaded as UTF-8 as well as Ascii)
Something is wrong here the very strange way...
GPX=LoadXML(#PB_Any,"GPSdata_in.gpx",#PB_UTF8)
SaveXML(GPX,"GPSdata_out.gpx")
Of course the file GPSdata_in.gpx is a valid XML document (created by the GPS unit or GPS software) with the UTF-8 encoding. 2 GPS devices and at least 3 different programs (English language ones) understand those Polish characters correctly.
I have found one way to keep them intact: Load the XML as it was in #PB_Ascii encoding. But after saving it changes the XML header (to "ISO-8859-1"), thus the GPS device reads such a file misinterpreting characters...If you manually change the XML header in the file created this way back to "UTF-8", everything is OK.
Same messy problems with the creation of XML (CreateXML(...) command). Polish characters from the text fields are encoded the wrong way.
And additionally, to make things even worse, the text fields read from the XML are displayed the wrong way on the screen (always, both when the XML was loaded as UTF-8 as well as Ascii)
Something is wrong here the very strange way...