updated git and svn scripts
[xrzperl.git] / js_unescape
blob7ba27e6c2441b138999ce777457f9855100fea55
1 #!/usr/bin/perl -W
2 use encoding utf8;
3 $ARGV[0]="--help" unless(@ARGV);
4 exit 0 unless(system("plhelp",$0,(@ARGV)));
6 sub js_unescape {
7 foreach(@_) {
8 $_ =~ s/%u([0-9a-f]+)/chr(hex($1))/eig;
9 $_ =~ s/%([0-9a-f]{2})/chr(hex($1))/eig;
10 print($_);
13 if ( @ARGV<1 ) {
14 &js_unescape(<STDIN>);
16 else {
17 my @strings;
18 foreach(@ARGV) {
19 push(@strings,Encode::decode("utf8",$_));
21 &js_unescape(@strings);