I am having an admin module and a front end module.
I have a category section.
I create categories by posting the value from the text box to php through ajax.
Both admin and front end charset is utf-8.
I read that by default ajax use utf-8 encoding.
while i post the data it is saved in the database perfectly.
I can see that unicode text in the database.
as well as i can see it while listing in the admin and in the front end.
BUT
when i click edit what i do is i fetch the data from the server using ajax/json
what i get is just ????? instead of the unicode text.
Where as in normal loading it is displayed well.
What could be the problem… what i am missing?
Edit
var jax = createAjax();
jax.open("POST",path,true)
jax.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8');
jax.onreadystatechange = afunction;
here is the php code
$query = "select * from $box where id=$id";
if(! ($res = mysql_query($query)))die(mysql_error());
$rs = mysql_fetch_array($res,1);
$rs['status'] = 1;
header("Content-Type: text/html; charset=utf-8");
die(json_encode($rs));
i have used the above for both request and response… even i have changed utf-8 to iso-85**-1 some thing that default but no effect.
i have attached the screen shots below
Open the images in new window or tab to see it bigger

in the above image you can see the utf char is displayed well in the listing but when edited ussing ajax and json it is dislayed as ???? in the text box.

and here is how the text appears in the db…

this helped me over come that problem.
execute this query after you made the connection.
i got this information form code igniter framework because using that my code work working well but when i used mysql_query directly i couldnt get expected result.
if you are using code igniter then this is made by default else you have to do include that line.
I am not accepting this as my own answer because there might be some more reasons that could be posted by users so i am waiting for more comments and answers for this question.
anyway it is working now.
Besides, make sure that the table collation is utf8, and the field is also that.