Home > X++ stuffs > Get File Encoding in Dynamics AX using X++

Get File Encoding in Dynamics AX using X++


Hi All,

Recently there was an interesting query from one of the technical forum.

Publisher: http://objectmix.com/axapta/789064-get-file-encoding.html

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.

Path: http://cid-264a0056cbcbb1d3.skydrive.live.com/self.aspx/.Public/Class%5E_RetriveXMLEncodingFormat.xpo

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:

Happy DaxingggggggggLeft hugRight hug

Categories: X++ stuffs
  1. Santosh.
    November 6, 2009 at 6:14 pm

    Thanks Dilip [:)]

  2. dilip
    November 5, 2009 at 3:31 pm

    Hey Santosh, Dilip here from http://daxdilip.blogspot.com/Nice one dude :-), A more detailed usage of Bindata. Thanks for the post and keep posting. I will add your blog to my list.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: