title: Setting up cpanel server for PHP UTF-8 characters [BOM error]
body: <p>I've been having a bit of a headache getting my server working with UTF-8 characters. I have a list of UK towns some of which have Gaelic characters and some Scottish ones also have special characters it seems.</p>
  
  <p>To facilitate this the developer put a BOM at the start of the PHP file. On his server a Ubuntu setup this worked fine as apparently his PHP defaults to UTF-8. However on my server it caused an issue with the headers having been already sent (Obviously reading the BOM as ABC instead of a BOM declaration).</p>
  
  <p>I went into WHM and set the Default_charset in php.ini to UTF-8, and php info reads the default charset as UTF-8. I didn't want to edit the httpd.conf to set Apache to UTF-8 across the entire server as this would possible cause problems elsewhere so I set UTF-8 in the .htaccess file as follows</p>
  
  <pre><code>AddDefaultCharset utf-8
  </code></pre>
  
  <p>However the BOM was still being read as text and messing up the headers. With the BOM removed the page and the site works fine, just the special characters are read as random ISO characters.</p>
  
  <p>I don;t have much experience with server settings or administration and none with BOM or setting up and running PHP in UTF-8 so any help or leads would be a great help. no doubt I've done something extremely stupid and obvious.</p>