Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5262414
  • 博文数量: 1144
  • 博客积分: 11974
  • 博客等级: 上将
  • 技术积分: 12312
  • 用 户 组: 普通用户
  • 注册时间: 2005-04-13 20:06
文章存档

2017年(2)

2016年(14)

2015年(10)

2014年(28)

2013年(23)

2012年(29)

2011年(53)

2010年(86)

2009年(83)

2008年(43)

2007年(153)

2006年(575)

2005年(45)

分类: LINUX

2009-12-10 12:44:33

看 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";
 
阅读(1466) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~