drt96856 2012-05-17 11:57
浏览 35
已采纳

json_encode()UTF-8错误

I'm having some problem getting text with special characters (Swedish: "åäö") from the database.

If I just do a normal query,

"SELECT * FROM"  

and the echo out the result:

while($row = mysql_fetch_assoc($result))
{
    echo $row['text']; 
}

... the result is fine.

However, when doing json_encode($array), the special characters have been replaced:

{"id":"1","question":"fr\u00e5ga \u00e5\u00e4\u00f6"....

I don't know how many different things I tried, including converting the database to UTF-8, fields to utf8_general_ci, utf8_encode($string), utf8_decode($string), ....

  • 写回答

3条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥100 AZURE创建地图类webapp
      • ¥20 51单片机实训实验报告
      • ¥15 C# 循环读写数据中途突然变慢
      • ¥15 用Java实现双端队列
      • ¥150 ID3决策树实现分类
      • ¥15 multisim10安装后,找不到NI License Manager的程序来安装许可证
      • ¥15 C++银行卡系统 Help!
      • ¥15 R语言数据分析的相关问题
      • ¥15 模型导入SP后贴图纹理只有一个,拆了四张UV的,怎么解决?
      • ¥15 检索带order by 非常慢