PHP将外国人欧元符号从jQuery发送到php未格式化(在json中)

时间:2013-08-21 13:11:46

标签: php javascript

我有外国人欧元符号在客户端。我把这个参数转换为json,然后通过json发送到PHP后端。

问题是在服务器端,角色已损坏

campaignsJson.campaigns[i] ={}; 
campaignsJson.campaigns[i].advertiser_id = advertiserId;
campaignsJson.campaigns[i].sign_id = sign_id;
var campaignsJsonstringify = JSON.stringify(campaignsJson);
alert(campaignsJsonstringify); // THE eruo sign is ok 

//send via form
$.sendPost = function() {
    var campaignsJsonstringify = JSON.stringify(campaignsJson);
    $('#campaigns_json').val(campaignsJsonstringify);
     document.getElementById("container_send").submit();
}

<form id="container_send"  action="campaigns_action.php" method="post">
            <input type="hidden" id="campaigns_json" name="campaigns_j" value=""/>          
</form>


//PHP
if($_SERVER['REQUEST_METHOD'] == "POST") {
     $isError = false;
     if($_POST['campaigns_j'])
     {
        $campaigns_json = $_POST['campaigns_j'];
        echo $campaigns_json;
        //Here is the foreigner euro sign is printed as gibrish
     } 
}

我需要有效字符串的字符串并将其引用到第三方API 为此,我需要保持从客户端发送的字符串有效。

0 个答案:

没有答案