Hi,
using
this code from #NULL, I can confirm the problem with PB 5.62 (x64) on Linux Mint 18.3 and on Windows 10, as well with PB 5.70 beta 4 on Windows 10.
NicTheQuick wrote:Is there a known workaround for this?
As a workaround, the following code seems to work here with the above mentioned PB versions and operating systems:
Code: Select all
; slightly changed after <https://www.purebasic.fr/english/viewtopic.php?p=530436#p530436>
EnableExplicit
Define xml.i = LoadXML(#PB_Any, "Recipes.xml")
Define encoding.i = GetXMLEncoding(xml)
Define size.i = ExportXMLSize(xml) + 100
Define *buffer = AllocateMemory(size)
Debug size
Debug ""
If ExportXML(xml, *buffer, size)
; ShowMemoryViewer(*buffer, size)
Debug PeekS(*buffer, -1, encoding)
EndIf
FreeMemory(*buffer)
So I also think that the cause of the problem is a wrong return value of
ExportXMLSize().
I guess that using something like
might be safe for all "normal" XML files.