-
最新日志
最新评论
- 拟谷盗 发表于《快速制作自动登录QQ的小脚本》
- regvip2008 发表于《快速制作自动登录QQ的小脚本》
- lxmxn 发表于《Batch Script处理文本文件的局限》
- lxmxn 发表于《文件列表附加文件大小》
- yovie 发表于《文件列表附加文件大小》
存档页
分类
功能
Tag Archives: Perl
perl中对URL地址进行编码
URL中如果有中文的字符,要先对其进行编码才能进行下一步的处理。 用替换方法进行编码: Url encode:对 \n 不转码 perl -pe 's/([^\w\-\.\@])/$1 eq "\n" ? "\n":sprintf("%%%2.2x",ord($1))/eg' keywords.list 用替换方法进行解码: Url Decode: perl -pe 's/%(..)/pack("c", hex($1))/eg' keywords.list 用URI::URL模块进行编码 use URI::URL; my $str = "http://www.google.com/lxmxn's blog&b=Hello,perl"; my $url = URI::URL->new( $str ); print $url; 用URI::Escape模块进行编码 use … Continue reading