1:php 编码是utf-8 但是接口需要是gbk 这么办??
$message = "你的微点管理地址为:".$shortUrl." [请保存信息]";
//echo
$message."<br>";exit;
$message=iconv("UTF-8","gb2312",$message);
2:接口返回时gbk 但是php页面时utf8?
$result=file_get_contents($jiekouurl);
$html = iconv("gbk",
"utf-8",$result);
$doc = new DOMDocument();
$xml=simplexml_load_string($html);
$humans = $doc->getElementsByTagName("result");
3:html body上面有空白 ?
用editplus 去掉+bom
4:电脑上面显示正常,但是手机上乱码 ?
用editplus 去掉+bom
特别是手机上面 有些地方如果需要gkb或者utf8转码的时候 ,第一步先去掉+bom
原文:http://www.cnblogs.com/hxl2009/p/3598742.html