把utf8字符输出成url格式
sub url_encode {
# default argument is $_
local $_ = @_ ? shift : $_;
defined or return;
# change unsafe characters (except for space) to encoded value
s/([^\w()'*~!.-])/sprintf '%%%02x', ord($1)/eg;
# change spaces to +
tr/ /+/;
return $_;
}
0 Comments:
Post a Comment
<< Home