0

我正在调用一个在 php.ini 中开发的 web 服务。当我选择中文时,WS 的响应不正确。对于其他语言来说它很好,但对于中文行为是不正常的。

WS 的输出是

{

    "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"
            }
        ]
    }

}  

我期待"question":"我们可以得到我们的家庭会议?"而不是"question": "??????????????",

请帮我解决这个问题。提前致谢。

4

1 回答 1

0

试试这个简单的代码:

编辑

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

这给出了字符的原样。因此,在将数据发送到 Web 服务(从数据库)以进行问题编码并再次解码时。因为问题在于这些字符的编码。

于 2013-08-30T11:37:21.430 回答