XML problem with control characters (ascii 1-31)
Posted: Mon May 14, 2018 3:30 pm
XML 1.1 supports all ascii controls from $01 [SOH] to $1F [US]. But If you use that, then the correct characters are in the XML file after saving, but loading don't work:
saved XML-file is correct:
https://www.dropbox.com/s/gq6qi2jfvh0afkx/ascii-xml.png
Code: Select all
Structure Person
Name$
Age.l
List Books.s()
EndStructure
Define P.Person
P\Name$ = "John Smith " + Chr(17) + Chr(1) + " xxx" ; means [DC1] + [SOH]
P\Age = 42
AddElement(P\Books()): P\Books() = "Investing For Dummies"
AddElement(P\Books()): P\Books() = "A Little Bit of Everything For Dummies"
Debug P\Name$
Debug P\Age
If CreateXML(0)
InsertXMLStructure(RootXMLNode(0), @P, Person)
FormatXML(0, #PB_XML_ReFormat)
SaveXML(0, "test.xml")
FreeXML(0)
EndIf
If LoadXML(0, "test.xml")
ExtractXMLStructure(MainXMLNode(0), @P, Person)
FreeXML(0)
EndIf
Debug P\Name$
Debug P\Age
https://www.dropbox.com/s/gq6qi2jfvh0afkx/ascii-xml.png