php - how to display unicode characters using jquery ajax?


Here's the background. I trying to retrieve unicode characters from a mysql server using php, ajax, and jquery in the following code.

    $.post("test.php",{tableName: A_table}, function(data)
         $.each($(data), function(key, value)
            display data into an UL List and not display weird unicode characters, like            00101C


Based on the code above, how do I get unicode characters to display.




you should force thecharset header of your response to beUTF-8 (or other suitable charset for your needs), or you could previously convert all your unicode characters on server side with mb_convert_encoding

example (taken from manual page)

$text = "A strange string to pass, maybe with some ø, æ, å characters.";

foreach(mb_list_encodings() as $chr){
    echo mb_convert_encoding($text, 'UTF-8', $chr)." : ".$chr."<br>";   

People are also looking for solutions to the problem: html - Take the name attribute of an option element and put it into a php variable


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.