//GB2312的Encode
echo urlencode("中文-_. ")."\n"; //%D6%D0%CE%C4-_.+ //将中文文字转换成urlencode文字编码
echo urldecode("%D6%D0%CE%C4-_. ")."\n"; //中文-_. //将urlencode文字编码转换成中文文字
一、将文件存为UTF-8文件,直接使用urlencode、rawurlencode即可。
$url = 'http://blog.youkuaiyun.com/中文.rar';
echo urlencode(mb_convert_encoding($url, 'utf-8', 'gb2312'))."\n";
echo rawurlencode(mb_convert_encoding($url, 'utf-8', 'gb2312'))."\n";
//http%3A%2F%2Fs.jb51.net%2F%E4%B8%AD%E6%96%87.rar