<script type="text/javascript">
var jsonObj = {"string": ""};
jsonObj.string = btoa(encodeURI( "中文特殊字符要编码过" ));
var jsonStr = JSON.stringify(jsonObj);
</script>
<?php
$jsonStr = $_POST["jsonStr"];
$jsonObj = json_decode($jsonStr, true);
$jsonObj["string"] = urldecode(base64_decode( $jsonObj["string"] ));
$jsonObj = ["string"=>""];
$jsonObj["string"] = base64_encode(urlencode("中文特殊字符要编码过"));
exit( json_encode($jsonObj) );
?>
<script type="text/javascript">
var jsonStr ;
var jsonObj = JSON.parse( jsonStr );
jsonObj.string = decodeURIComponent(atob(jsonObj.string).replaceAll("+", " "));
</script>