This post was originally published here

Today was another day of new BizTalk problems … The task was easy; produce a XML file and send to a receiving system. Fine. Done. … Not.

The receiving system could not read the file because of some strange characters in the beginning of the file! It looked something like the below when opening the file in a fancy text editor (UltraEdit or TextPad for example).

<div><span style="color: #000000; ">i»¿</span><span style="color: #0000FF; "><?</span><span style="color: #FF00FF; ">xml version="1.0" encoding="utf-8"</span><span style="color: #0000FF; ">?></span></div>

After a couple of very interesting (:/) hours of Googling) I found this from Ben McFarlin

>
> It is because internal BizTalk messages are in UTF8 format and include
the byte order mark. When you added the xml declaration for UTF16 it
confused the engine; the declaration read UTF16 but the byte order mark indicated UTF8.
>
>

When I finally found the cause the solution was easy. Just another of those weird properties … This time it’s called Preserve BOM (on the properties of the XML Assembly pipeline component – see figure on the right). BOM of course stands for Byte Order Mark.