doufang3001 2013-08-30 11:21
浏览 34

中文字符问题,PHP webservice

I am calling one webservice which developed in the php. the response of WS is not being correct while i select Chinese language. for other language its fine but for Chinese behavior is abnormal.

the output of WS is

{

    "response": {
        "@attributes": {
            "error": 0
        },
        "code": 200,
        "message": "success",
        "data": [
            {
                "faq_id": "4",
                "app_id": "7",
                "question": "What is the main goal for the conference?",
                "answer": "This conference is designed to review our Q3 achievements and plan our Q4 goals",
                "status": "1"
            },
            {
                "faq_id": "5",
                "app_id": "7",
                "question": "??????????????",
                "answer": "This is strictly an employee only conference.",
                "status": "1"
            },
            {
                "faq_id": "6",
                "app_id": "7",
                "question": "Where do we stay for the conference?",
                "answer": "Details on accomodations will be provided to you before the conference begins",
                "status": "1"
            }
        ]
    }

}  

and i am expecting "question":"我们可以得到我们的家庭会议?" instead of "question": "??????????????",

please help me to sort out this issue. thanks in advance.

  • 写回答

1条回答 默认 最新

  • donglian1384 2013-08-30 11:37
    关注

    Try this simple code:

    EDIT

        $str1 = base64_encode("我们可以得到我们的家庭会议?");
        $str2 = base64_decode($str1);
        echo $str2;
    

    This gives the characters as they are. So, while sending the data to web service (from database) for question encode it and decode it again. Because the problem is with encoding for these characters.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度