看 log 時快速解碼用的,一行搞定:
SHELL> echo "%3A%22abc%22" | perl -MURI::Escape -ne 'print uri_unescape($_)'
:"abc"
看來某程式碰到非 ASCII 字元就會爛掉。
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";
阅读(1511) | 评论(0) | 转发(0) |