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.

    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决