Exporting sources as XML to stream
Recently I have been required to work with a method called ExportToStream.
The situation asks me to export a UTF-8-encoded JSON as a XML to be imported on old releases. Here's how I attempted to fulfill this request:
do $System.OBJ.ExportToStream("path/to/my/json/file.json", .stream,,,"UTF8")
The file is indeed encoded as UTF-8 and although the XML header denotes that it has been exported as UTF8:
<?xml version="1.0" encoding="UTF8"?>
The body content seems to differ:
"text": "CondiÃÂ§ÃÂ£o de pagamento sujeito a anÃÂ¡lise de crÃÂ©dito: "
I will say it again, the original file is encoded as UTF-8 and it displays correctly if seen from any editor.
Both the editor and the
file utility identifies the file as UTF-8 without BOM (and that is correct).
With that said, can anyone figure what am I doing wrong? Or is that a bug?
I used Caché 2017 and IRIS 2019.3, both presented the same issue.