doufen1933 2017-02-22 05:35
浏览 1204
已采纳

处理json_encode中的特殊字符

In my database, there are many special characters like (İstanbul, Yeşilköy, Atatürk and more).

when I directly fetch these data from the database all working fine. Means data remain original but problem occur when I convert these data to JSON using json_encode().

After encoding all these data converted to some strange characters like ?stanbul, Bak?rköy...

But after decodeing (using json_decode) I need the original string which was before encoding(json_encode).

I tried many solutions provided on the web to solve the problem but none of them is fully working in my case.

some solutions I tried-

If not possible to get the original string atleast there should not be any ? like thing(remove these things).

Suggest me something to solve the issue.

  • 写回答

3条回答 默认 最新

  • douchen2011 2017-12-01 07:38
    关注

    This library saved my life(https://github.com/neitanod/forceutf8).

    Previously I was using the wrong method to get the issue resolved. toUTF8() function was life saver.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 wpf ScrollViewer实现冻结左侧宽度w范围内的视图
  • ¥15 栅极驱动低侧烧毁MOSFET
  • ¥30 写segy数据时出错3
  • ¥100 linux下qt运行QCefView demo报错
  • ¥50 F1C100S下的红外解码IR_RX驱动问题
  • ¥20 基于matlab的航迹融合 航迹关联 航迹插补
  • ¥15 用Matlab实现图中的光线追迹
  • ¥15 联想笔记本开机出现系统更新界面
  • ¥15 各位帮帮我 我不想重做系统
  • ¥30 微信小程序蓝牙数据透传