title: How to avoid echoing character 65279 in php?
body: <p>I have encountered a similar problem described <a href="https://stackoverflow.com/questions/3449316/how-to-compare-xmlhttp-responsetext">here</a> (and in other places) - 
  where as on an ajax callback I get a xmlhttp.responseText that seems ok (when I alert it - it shows the right text) - but when using an 'if' statement to compare it to the string - it returns false.</p>
  
  <p>(I am also the one who wrote the server-side code returning that string) - after much studying the string - I've discovered that the string had an "invisible character" as its first character. A character that was not shown. If I copied it to Notepad - then deleted the first character - it won't delete until pressing Delete again.</p>
  
  <p>I did a charCodeAt(0) for the returned string in xmlhttp.responseText. And it returned <strong>65279</strong>.</p>
  
  <p>Googling it reveals that it is some sort of a UTF-8 control character that is supposed to set "big-endian" or "small-endian" encoding.</p>
  
  <p>So, now I know the cause of the problem - but... why does that character is being echoed?
  In the source php I simply use </p>
  
  <pre><code>echo 'the string'...
  </code></pre>
  
  <p>and it apparently somehow outputs [chr(65279)]the string...</p>
  
  <p>Why? And how can I avoid it?</p>