xsharp.eu • Xml file UTF-8 BOM - Page 2
Page 2 of 2

Xml file UTF-8 BOM

Posted: Tue Apr 20, 2021 6:26 am
by ArneOrtlinghaus
We use the attached function FGetFileEncoding to look for the format of the file.
It returns two parameters:
- The encoding (ANSI, UTF-8, Unicode)
- The characters to omit (the BOF-markers)

For reading lines with automatically treating correctly CRLF or CR or LF we use the attached object clsfilebuffered input. (Probably some functions are missing. If someone is interested, please write me)
ffileencoding.txt
(32.03 KiB) Downloaded 93 times
clsfile.txt
(51.49 KiB) Downloaded 105 times
Arne

Xml file UTF-8 BOM

Posted: Tue Apr 20, 2021 8:36 am
by ic2
Hello Wolfgang,
wriedmann wrote: it is much, much simpler do that in .NET than in plain VO..... I'm using them in through a COM module in VO
I basically do the same for multiple methods which are easier to implement in .Net than in VO. But I didn't find anything easier concerning XML in .Net. Reading UBL files, the proposed European standard for invoices, is just 2 functions in VO and then code like this, total 14 lines to read in all relevant data.

SELF:cXml:=StringReadZeroNoAnsi(cFile) // Read XML
SELF:cInvoiceDateXML:=SeekXMLElement("cbc:IssueDate",cXml,1) // etc

I do not see how that could be done easier in .Net.

Dick

Xml file UTF-8 BOM

Posted: Tue Apr 20, 2021 8:49 am
by wriedmann
Hi Dick,
the implementation of the XML functions seemed me easier in .NET than in VO.
And since I already need a .NET module for the webservice interaction, I have simply added my COM module.
Wolfgang

Xml file UTF-8 BOM

Posted: Tue Apr 20, 2021 11:35 am
by stecosta66
Hi all,
I'm testing now ChilKat ActiveX COM component and so far so good.

I need to manipulate extracted strings from the xml file node by node (I don't need all of them) as this have to be processed later for being inserted in a temp DB.

I also need to extract the xml data from digitally signed files (.p7m) and, some time, to extract the PDF attached to the xml file for archiving purpose.

Stefano

Xml file UTF-8 BOM

Posted: Tue Apr 20, 2021 12:55 pm
by Sherlock
Not tested and some wanted a simple VO syntax.. I remember this worked in some memo coversions.
Cannot remember it TRUE then FALSE or FALSE then true. Worth a shot

SetAnsi(TRUE)
cData := memoread( cData)
SetAnsi(FALSE)

Xml file UTF-8 BOM

Posted: Tue Apr 20, 2021 1:59 pm
by ic2
Hello Phil,
Sherlock wrote:Not tested and some wanted a simple VO syntax.. I remember this worked in some memo conversions.
TRUE specifies the ANSI format; FALSE specifies the OEM format.

So it's still a conversion. If something is converted incorrectly with ANSI then OEM may solve that but it also may not. The function I published few messages above does not have this issue.

Dick