<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Xml</title>
        <link>http://geekswithblogs.net/mucman/category/6534.aspx</link>
        <description>Xml</description>
        <language>en-CA</language>
        <copyright>Scott Muc</copyright>
        <managingEditor>scottmuc@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Ditching XML document Byte Order Mark (BOM)</title>
            <link>http://geekswithblogs.net/mucman/archive/2007/04/17/111742.aspx</link>
            <description>&lt;p&gt;
It came to my attention recently that some XML output (ASX files) is not working on the Mac platform. Asx is the Windows Media playlist file format. I am using the XmlTextWriter object to output to a text file, and these files are located on a webserver so people can click on them and listen to pretty music.&lt;/p&gt;
&lt;p&gt;
Unfortunately these files don't work on the mac because it chokes on the BOM. &lt;a href="http://west-wind.com/WebLog/posts/10540.aspx"&gt;Removing the BOM&lt;/a&gt; fixed the issue. Yay, I'm happy and so is the client. Unfortunately I'm left feeling like I shouldn't have had to make that change. Why would the BOM be a problem?
&lt;/p&gt;
&lt;p&gt;
I did some research and found a couple good resources: &lt;a href="http://unicode.org/faq/utf_bom.html#BOM"&gt;Unicode.org&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Byte_Order_Mark"&gt;Wikipedia&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The one thing that I picked up is that the UTF-8 encoding doesn't have a specific &lt;a href="http://en.wikipedia.org/wiki/Endianness"&gt;endianness&lt;/a&gt;. So I don't need to have an explicit label to declare the edianness. Also, UTF-8 is byte for byte the same as ASCII. It's when you have a character in high-latin space that the document begins to break (&lt;a href="http://www.hanselman.com/blog/TheImportanceOfBeingUTF8.aspx"&gt;Scott Hanselman&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;
Because of these findings, I've decided to start writing all of my Xml output without the BOM. These are the following assumptions for this decision:
&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;I don't have to worry about apps that can't handle a BOM&lt;/li&gt;
    &lt;li&gt;Files will operate in Unix without any BOM issues in text editors&lt;/li&gt;
    &lt;li&gt;In Web requests, I can get the encoding via the mime type&lt;/li&gt;
    &lt;li&gt;If I am consuming Xml in my code, I already know it's Xml and don't need a BOM signature to tell me&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The main negative that I see is that if a document is something other than UTF-8 and I attempt to open it in a text editor, I won't know the encoding... but if I only discard the BOM in UTF-8 documents, this shouldn't be a problem.
&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=111742"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=111742" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mucman/aggbug/111742.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Scott Muc</dc:creator>
            <guid>http://geekswithblogs.net/mucman/archive/2007/04/17/111742.aspx</guid>
            <pubDate>Tue, 17 Apr 2007 20:11:30 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mucman/comments/111742.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mucman/archive/2007/04/17/111742.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/mucman/comments/commentRss/111742.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mucman/services/trackbacks/111742.aspx</trackback:ping>
        </item>
    </channel>
</rss>