diff options
Diffstat (limited to 'textproc/namazu2/patches/patch-aq')
-rw-r--r-- | textproc/namazu2/patches/patch-aq | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/textproc/namazu2/patches/patch-aq b/textproc/namazu2/patches/patch-aq new file mode 100644 index 00000000000..d3e429e12ec --- /dev/null +++ b/textproc/namazu2/patches/patch-aq @@ -0,0 +1,59 @@ +$NetBSD: patch-aq,v 1.1 2003/05/25 14:12:13 taca Exp $ + +--- filter/pdf.pl.orig 2002-07-30 15:03:08.000000000 +0900 ++++ filter/pdf.pl +@@ -31,7 +31,9 @@ require 'gfilter.pl'; + my $pdfconvpath = undef; + my $pdfinfopath = undef; + my $pdfconvver = 0; ++my $pdfinfover = 0; + my $pdfconvarg = ''; ++my $pdfinfoarg = ''; + + sub mediatype() { + return ('application/pdf'); +@@ -52,6 +54,19 @@ sub status() { + $pdfconvarg = '-eucjp'; + } + } ++ if (defined $pdfinfopath) { ++ my $ret = `$pdfinfopath 2>&1`; ++ if ($ret =~ /^pdfinfo\s+version\s+([0-9]+\.[0-9]+)/) { ++ $pdfinfover = $1; ++ } ++ if (util::islang("ja")) { ++ if ($pdfinfover >= 2.02) { ++ $pdfinfoarg = '-enc EUC-JP'; ++ } else { ++ $pdfinfoarg = ''; ++ } ++ } ++ } + return 'yes'; + } + return 'no'; +@@ -116,7 +131,7 @@ sub filter ($$$$$) { + # system("$pdfinfopath $tmpfile > $tmpfile3"); + open(SAVEOUT, ">&STDOUT"); + open(STDOUT, ">$tmpfile3"); +- system("$pdfinfopath $tmpfile"); ++ system("$pdfinfopath $pdfinfoarg $tmpfile"); + open(STDOUT, ">&SAVEOUT"); + my $fh = util::efopen("< $tmpfile3"); + my $cont2 = util::readfile($fh); +@@ -124,9 +139,15 @@ sub filter ($$$$$) { + unlink($tmpfile3); + if ($cont2 =~ /Title: (.*)/) { # or /Subject: (.*)/ + $fields->{'title'} = $1; ++ if ($fields->{'title'} =~ /<unicode>/) { ++ $fields->{'title'} = undef; ++ } + } + if ($cont2 =~ /Author: (.*)/) { + $fields->{'author'} = $1; ++ if ($fields->{'author'} =~ /<unicode>/) { ++ $fields->{'author'} = undef; ++ } + } + } + |