<?xml version="1.0" encoding="windows-1252"?>
<node id="724497" title="Re: Remove BOM ?" created="2008-11-19 02:39:13" updated="2008-11-19 02:39:13">
<type id="11">
note</type>
<author id="616540">
moritz</author>
<data>
<field name="doctext">
You can do it like you want, if you decode the file:

&lt;code&gt;
open IN, ':&lt;encoding(UTF-8)', $file or die $!;

# your code here
&lt;/code&gt;

&lt;p&gt;If you don't decode the file, you have to remove the byte sequences that represent the BOM in the encoding that your file has.

&lt;p&gt;Update: The big difference between vim and perl (in this respect) is that vim tries to auto-detect the character encoding (which is a sane thing to do for a text editor, especially if the text are longer, and represent human language) and decodes the text with the guessed encoding, while perl doesn't try to guess anything (which is a sane thing to do for a general purpose programming language).</field>
<field name="root_node">
724474</field>
<field name="parent_node">
724474</field>
</data>
</node>
