From 9a82b18c721a40d58b86792fc7740bd33607ec85 Mon Sep 17 00:00:00 2001 From: yshl Date: Tue, 28 Jul 2015 20:58:02 +0900 Subject: modified: Bonus/goodict.cgi, use Encode.pm instead of NKF --- Bonus/goodict.cgi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Bonus/goodict.cgi b/Bonus/goodict.cgi index 8f443c1..5106c89 100755 --- a/Bonus/goodict.cgi +++ b/Bonus/goodict.cgi @@ -5,7 +5,8 @@ # w: file:/cgi-bin/goodict.cgi?%s # j: file:/cgi-bin/goodict.cgi?%s -use NKF; +use Encode; +use Encode::Guess qw/euc-jp utf8/; #$mode = 0; # substring $mode = 1; # perfect match #$mode = 3; # search body text @@ -22,7 +23,7 @@ s@^[ewjs]:@@ && s@^//@@ && s@/$@@; if ($_) { s/\+/ /g; s/%([\da-f][\da-f])/pack('C', hex($1))/egi; - $_ = nkf("-e", $_); + $_ = encode("utf8", decode("Guess", $_)); s/[\000-\040\+:#?&%<>"\177-\377]/sprintf('%%%02X', unpack('C', $&))/eg; $url .= "/search.php?MT=$_&kind=$kind&mode=$mode"; } else { -- cgit v1.2.3 From 9e6b2e19aa4023f20a093a6a19bcb88f9710dbf8 Mon Sep 17 00:00:00 2001 From: yshl Date: Tue, 28 Jul 2015 21:12:51 +0900 Subject: modified: Bonus/goodict.cgi, update to the current URL --- Bonus/goodict.cgi | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Bonus/goodict.cgi b/Bonus/goodict.cgi index 5106c89..5fb6581 100755 --- a/Bonus/goodict.cgi +++ b/Bonus/goodict.cgi @@ -1,15 +1,20 @@ #!/usr/bin/perl # ~/.w3m/urimethodmap -# e: file:/cgi-bin/goodict.cgi?%s -# w: file:/cgi-bin/goodict.cgi?%s -# j: file:/cgi-bin/goodict.cgi?%s +# e: file:/cgi-bin/goodict.cgi?%s Englich-Japanese +# w: file:/cgi-bin/goodict.cgi?%s Japanese-English +# j: file:/cgi-bin/goodict.cgi?%s Japanese +# a: file:/cgi-bin/goodict.cgi?%s All +# +# e:0:word start with word +# e:1:word perfect match +# e:2:word end with word +# e:3:word search body text +# e:6:word search title +# e:word perfect match use Encode; use Encode::Guess qw/euc-jp utf8/; -#$mode = 0; # substring -$mode = 1; # perfect match -#$mode = 3; # search body text $url = "http://dictionary.goo.ne.jp"; $_ = $ENV{"QUERY_STRING"}; if (/^e:/) { @@ -18,14 +23,22 @@ if (/^e:/) { $kind = 'je'; } elsif (/^j:/) { $kind = 'jn'; +} elsif (/^a:/) { + $kind = 'all' +} +s@^[ewja]:@@ && s@^//@@ && s@/$@@; +if (/^([01236]):/) { + $mode=$1; + s/^[01236]://; +}else{ + $mode="1"; } -s@^[ewjs]:@@ && s@^//@@ && s@/$@@; if ($_) { s/\+/ /g; s/%([\da-f][\da-f])/pack('C', hex($1))/egi; $_ = encode("utf8", decode("Guess", $_)); s/[\000-\040\+:#?&%<>"\177-\377]/sprintf('%%%02X', unpack('C', $&))/eg; - $url .= "/search.php?MT=$_&kind=$kind&mode=$mode"; + $url .= "/srch/$kind/$_/m$mode"."u/"; } else { $input = "w3m-control: GOTO_LINK"; } -- cgit v1.2.3