ajax and ISO-8859-1
01-Jan-08
We all have been through this - You make your ajax request to the php file and in firefox you obtain different output than in IE (I’m talking about characters with accents). Obviously you know very well that this has to do with the charset but you can’t remember exactly how you solved the problem the last time?
OK in your javascript code just before you send ajax request you need to do this:
s_send_value = encodeURIComponent(s_send_value);
in the php file you reffered by your request before any output you’ll need;
header(’Content-Type: text/html; charset=utf-8′);
the data you get:
$s_recieved_value = utf8_decode($s_recieved_value);
and the output for your ajax request:
$s_response = utf8_encode($s_response);
