Hi All,
Recently there was an interesting query from one of the technical forum.
Question: How to get encoding file format from xml in Dynamics AX?
Answer: I have created a small class which would retrieve the encoding format of an Xml.
Approach Followed:
· Class receives input file as string.
· Based on the input file, the XmlReader is initialized.
· Xml is read using read () method from XmlReader
· When xmlReader.name () is equal to the XmlEncodingAttribute then encoding format is returned.
Second part of question is possible convert it to ANSI before reading?
Instead of trying to convert a file in ANSI it would be better we use Binary class to read and write data in the binary format even though if there is special character in the file. Since reading with ASCIIIO will only support NON ASCI character so binary is the better option.
Here is the sample example using BinData kernel class:
Aucun commentaire:
Enregistrer un commentaire