title: How to create a UTF8 File in C#
body: <p>As per question how to i create a a file that also includes the Byte Order Mark?</p>
  
  <p>Having some trouble displaying some chars because the csv viewer cannot display the chars correctly without the BOM.</p>
  
  <p>Appreciate any help.</p>
  
  <p>EDIT To Include code:</p>
  
  <pre><code>string attachment = string.Format("attachment; filename=results_{0}_to _{1}.csv", startDate.ToString("MM_yy_yyyy"), endDate.ToString("MM_yy_yyyy"));
  HttpContext.Current.Response.AddHeader("content-disposition", attachment);
  HttpContext.Current.Response.ContentType = "text/csv";
  HttpContext.Current.Response.AddHeader("Pragma", "public");
  
  string content = GetTextFromDB();
  
  HttpContext.Current.Response.Write(content);
  HttpContext.Current.Response.End();
  </code></pre>