perl URLencode URLdecode的方法

<pre name="code" class="html">一个perl URLencode URLdecode的方法

这是url的uri_escape和uri_unescape,不是针对html的


#引入模块
use URI::Escape;
#urlencode
$encoded = uri_escape("10% is enough
"); 
#urldecode
$decoded  = uri_unescape($encoded);


jrhmpt01:/root/wx# cat s3.pl 
use URI::Escape;
$encoded=uri_escape('@crypt_597aeefd_10918236aa7c541a78a1b25880eeb1cb');
print "$encoded is $encoded
";

jrhmpt01:/root/wx# perl s3.pl 
$encoded is %40crypt_597aeefd_10918236aa7c541a78a1b25880eeb1cb



                                    
原文地址:https://www.cnblogs.com/hzcya1995/p/13351061.html