title: Write text files without Byte Order Mark (BOM)?
body: <p>I am trying to create a text file using VB.Net with UTF8 encoding, without BOM. Can anybody help me, how to do this?
  <br>
  I can write file with UTF8 encoding but, how to remove Byte Order Mark from it?
  <br></p>
  
  <p>edit1:
  I have tried code like this;</p>
  
  <pre><code>    Dim utf8 As New UTF8Encoding()
      Dim utf8EmitBOM As New UTF8Encoding(True)
      Dim strW As New StreamWriter("c:\temp\bom\1.html", True, utf8EmitBOM)
      strW.Write(utf8EmitBOM.GetPreamble())
      strW.WriteLine("hi there")
      strW.Close()
  
          Dim strw2 As New StreamWriter("c:\temp\bom\2.html", True, utf8)
          strw2.Write(utf8.GetPreamble())
          strw2.WriteLine("hi there")
          strw2.Close()
  </code></pre>
  
  <p>1.html get created with UTF8 encoding only and 2.html get created with ANSI encoding format.</p>
  
  <p>Simplified approach - <a href="http://whatilearnttuday.blogspot.com/2011/10/write-text-files-without-byte-order.html" rel="noreferrer">http://whatilearnttuday.blogspot.com/2011/10/write-text-files-without-byte-order.html</a></p>