Php 如何使用jquery ajax显示unicode字符?
这是背景。我试图在下面的代码中使用php、ajax和jquery从mysql服务器检索unicode字符Php 如何使用jquery ajax显示unicode字符?,php,jquery,ajax,Php,Jquery,Ajax,这是背景。我试图在下面的代码中使用php、ajax和jquery从mysql服务器检索unicode字符 $.post("test.php",{tableName: A_table}, function(data) { $.each($(data), function(key, value) { display data into an UL List and not display weird unicode char
$.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
}
});
基于上面的代码,如何获得要显示的unicode字符 您应该强制响应的
字符集
标题为UTF-8
(或其他适合您需要的字符集),或者您可以事先使用
示例(摘自手册页)
<?php
$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>";
}
?>