title: Remove BOM from string in Java
body: <p>I have string in file, that contains BOM (from UTF-8). I want to convert this string to win-1251 and put it in file.</p>
  
  <p>I trying to remove BOM from string in this way:</p>
  
  <pre><code>out.write(l.replace('\uFEFF','\0') + "\n");
  </code></pre>
  
  <p>But it don't work. Why?</p>
  
  <p>Output of this string in win-1251 file:</p>
  
  <pre><code>?1,...SOME_TEXT_HERE
  </code></pre>
  
  <p>First "?" sign is illegal.</p>