function buildRequestForm($para_temp, $method, $button_name) {
//待请求参数数组
$para = $this->buildRequestPara($para_temp);
$sHtml = "<meta http-equiv='content-type' content='text/html; charset=utf-8'><form id='llpaysubmit' name='llpaysubmit' action='" . $this->llpay_gateway_new . "' method='" . $method . "'>";
$sHtml .= "<input type='hidden' name='req_data' value='" . $para . "'/>";
//submit按钮控件请不要含有name属性
// $sHtml = $sHtml . "<input type='submit' value='" . $button_name . "'>";
$sHtml = $sHtml . "</form>";
$sHtml = $sHtml."<script>document.forms['llpaysubmit'].submit();</script>";
return $sHtml;
}
原因参考了以下
http://www.360doc.com/content/11/1125/09/8157240_167208721.shtml
=>任意给定的3个汉字 <br>=>UTF-8使用9个bytes编码之(123|456|789) <br>=>这9个bytes通过网络传给tomcat <br>=>tomcat认为这9个字节是gbk编码(因为你配置了tomcat) <br>=>gbk汉字编码规则12|34|56|78|9 <br>=>构建string时<strong>至少</strong>最后一个字节不能正确解析为汉字,此时使用?代替 <br>=>在对这个至少带一个问号的string.getBytes("gbk")时,肯定将出现问号ascii码(63)的byte <br>=>以utf-8构造string时,遇到63的地方肯定输出? <br>=>产生了你说的现象 <br><br>
需要在form前面加上编码,就可以了.还有别的要
<meta http-equiv='content-type' content='text/html; charset=utf-8'>
还有utf-8的字符截取问题,截取的长度参考https://www.cnblogs.com/secondtononewe/p/6132923.html