file:///mnt/music/%D5%C5%D1%A7%D3%D1/%CD%FC%BC%C7%C4%E3%CE%D2%D7%F6%B2%BB%B5%BD.mp3
用perl把%xx转成相应的字.
有两种方法:
1.正则匹配
2.使用URI::Escape模块
use URI::Escape;
$a='file:///mnt/music/%D5%C5%D1%A7%D3%D1/%CD%FC%BC%C7%C4%E3%CE%D2%D7%F6%B2%BB%B5%BD.mp3'; print $a."\n";
$a =~ s/(%)(..)/chr (oct "0x".$2)/ge; print $a."\n";
print URI::Escape::uri_escape("$a"),"\n";
print URI::Escape::uri_unescape("$a"),"\n";
|
阅读(556) | 评论(0) | 转发(0) |