UTF-8 BOM in php response to mootools xmlhttprequest

Posted by Jimmy on Stack Overflow See other posts from Stack Overflow or by Jimmy
Published on 2010-06-03T15:52:58Z Indexed on 2010/06/03 16:34 UTC
Read the original article Hit count: 339

Filed under:
|
|
|
|

Hi,

I'm writing my first little AJAX-enabled Joomla component. I'm using mootools. I got a xmlhttprequest to contact my Joomla component, and the component returns a response - just plain text echoed by php, like

echo 'Hello World!';

It's all working fine, except wireshark tells me that the response is prepended with \357\273\277\357\273\277 when it gets read by the javascript on the client side. This shows up as a little square before the response in an alert box that the script shows.

I don't explicitly set the encoding on the xmlhttprequest; mootools docs say that it defaults to UTF8.

What's the right way to handle this? Should I be setting the encoding on the request? Mime type? Should the javascript get rid of it? I'm not planning to have any characters requiring UTF8 in the response, so using plain old ascii would be ok for me too.

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about AJAX