Friday, December 22, 2006

Commerce Server Catalog Manager Encoding (UTF-8/UTF-16) issue

While working on Automated Catalog process using BizTalk Server Adapters for Commerce Server Catalog Subsystem found some thing interesting with Xml file (Processed by Catalog Manager) I am using Aggregator Pattern in BizTalk to generate final XML file which grabbed and processed by the Catalog Web service.

First I wasn't successful, thought that issue with encoding in the XML file, so decided to deploy Pipeline to set the encoding UTF-16 instead of default UTF-8 in XML assembly but again the end results wasn't fruitful (thou the file grow twice because of encoding).

While comparing the xml file got an idea!!. How about open the file in the Explorer copy and past the content into notepad and save the file as xml (removed -, + then Change "&" to "&" etc) then pass it to Catalog Web service also failed

Then I realized to use hex editors or Unicode editors. Since UTF-8 is the byte-oriented encoding form of Unicode. Quickly googled out and found few wonderful freeware did the same as above this time it worked with out any glitch.

Then I open up both file in Binary Editor found the difference, before it was 3E 3C where as with the Unicode editor (since open up the file in explorer) saved file 3E 20 0D 0A 3C

20 --> Space; 0D --> CR; 0A --> NL
With this can I say that Catalog Manager Parser expecting a well formatted XML file. Or it’s not well written to handle above scenario!?? at this point I don't know yet it to be consider as bug!!

No comments: