上面的XML文档请使用这个字符串进行urldecode后得到:
%3C%3Fxml+version%3D%221.0%22+encoding%3D%22gb18030%22%3F%3E%3Cxml%3E%DF%C7%85%F7%85%C0.%07%3C%2Fxml%3E
%3C%3Fxml+version%3D%221.0%22+encoding%3D%22gb18030%22%3F%3E%3Cxml%3E%DF%C7%85%F7%85%C0.%07%3C%2Fxml%3E
<?xml version="1.0" encoding="utf-8" ?>
<xml>咔咓吚.</xml>2.将xml文件用记录本另存为 utf-8格式3.PHP文件本身也用记事本存为utf-84.在PHP文件头部加上
header('Content-type:text/html;charset=utf-8');
欢迎加入PHP爱好者QQ群:30169840
但是,估计楼主不喜欢 UTF-8 这种格式吧。
只是CSDN自动把 "<" 转为 "<" 了.<?xml version="1.0" encoding="gb18030" ?>
<xml><![CDATA[咔咓吚</test>.]]></xml>
//.....
$str = preg_replace("/[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]/", '', $str);
$str = htmlspecialchars($str);
htmlspecialchars 应该先转码再放到 <xml></xml> 里的
{
//---- 全角都转成半角 ----
$Queue = Array(
'0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4',
'5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9',
'A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E',
'F' => 'F', 'G' => 'G', 'H' => 'H', 'I' => 'I', 'J' => 'J',
'K' => 'K', 'L' => 'L', 'M' => 'M', 'N' => 'N', 'O' => 'O',
'P' => 'P', 'Q' => 'Q', 'R' => 'R', 'S' => 'S', 'T' => 'T',
'U' => 'U', 'V' => 'V', 'W' => 'W', 'X' => 'X', 'Y' => 'Y',
'Z' => 'Z', 'a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd',
'e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i',
'j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n',
'o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's',
't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x',
'y' => 'y', 'z' => 'z', '-' => '-', '!' => '!', '。' => '.',
',' => ',', '%' => '%', '、' => ',', '#' => '#', '¥' => '$',
'*' => '*', '(' => '(', ')' => ')', '|' => '|', '+' => '+',
'[' => '[', ']' => ']', '{' => '{', '}' => '}', '~' => '~',
':' => ':', ';' => ';', '/' => '/', '?' => '?', '—' => '-',
'“' => '"', '”' => '"', '‘' => "'", '’' => "'", '·' => '.'
);
$Str = preg_replace("/([\xA3][\xA1-\xAF\xB0-\xBF\xC1-\xDA\xE1-\xFC])/e", "\$Queue[\\1]", $Str);
$Str = preg_replace("/([\xA1][\xA1-\xAF\xB0-\xB9])/e", "\$Queue[\\1]", $Str);
return($Str);
}
function replace_xml($str)
{
//---- XML 非法字符过滤 ----
$str = SBC_DBC($str);
$str = preg_replace("/[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]/", '', $str);
$str = preg_replace("/[\r\n]+/", "\n", $str);
$str = preg_replace("/[ \t]+/", " ", $str);
$str = trim($str);
$str = htmlspecialchars($str);
return $str;
}
//... ...
$str = "... ...";
$str = replace_xml($str);
//... ...
chr(7) 转成 
chr(8) 转成 
chr(9) 转成 	
chr(10) 转成
... ...
需要自行编程解决,记得我发过一个的
需要自行编程解决,记得我发过一个的------------
就是想看你那个,再拿出来晒晒吧-___-!!!