/ Published in: PHP
URL: http://topic.csdn.net/u/20071006/18/34e13f63-970a-4bb8-8671-20d7fd701fe5.html?632863885
Expand |
Embed | Plain Text
function escape($str) { preg_match_all("/[\xc2-\xdf][\x80-\xbf]+|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}|[\x01-\x7f]+/e",$str,$r); //匹配utf-8字符, $str = $r[0]; for($i=0; $i <$l; $i++) { if($value < 223) { //先将utf8编码转换为ISO-8859-1编码的单字节字符,urlencode单字节字符. //utf8_decode()的作用相当于iconv("UTF-8","CP1252",$v)。 } else { } } }
You need to login to post a comment.
