--- search.rb.bak 2008-11-20 04:04:53.000000000 +0900 +++ search.rb 2009-04-07 03:26:31.000000000 +0900 @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby +#!/usr/local/bin/ruby # # tdiarysearch # @@ -31,10 +31,10 @@ HEADER = unindent <<'EOS' - +
- - + + @@ -133,7 +133,7 @@ BEGIN { $defout.binmode } def main - $KCODE = 'u' + $KCODE = 'EUC' cgi = CGI.new @config = TDiary::Config.new(cgi) @config.options['apply_plugin'] = true @@ -181,7 +181,7 @@ def send_html(cgi, html) print cgi.header('status' => '200 OK', 'type' => 'text/html', - 'charset' => 'utf-8', + 'charset' => 'EUC-JP', 'Content-Length' => html.length.to_s, 'Cache-Control' => 'no-cache', 'Pragma' => 'no-cache') @@ -191,7 +191,7 @@ def setup_patterns(query) patterns = split_string(query).map {|pat| check_pattern pat - /#{Regexp.quote(pat)}/iu + /#{Regexp.quote(pat)}/ie } raise WrongQuery, 'no pattern' if patterns.empty? raise WrongQuery, 'too many sub patterns' if patterns.length > 8 @@ -206,7 +206,7 @@ end def split_string(str) - str.split(/[\s#{Z_SPACE}]+/ou).reject {|w| w.empty? } + str.split(/[\s#{Z_SPACE}]+/oe).reject {|w| w.empty? } end def save_query(query, file) @@ -373,21 +373,21 @@ section = component if section.subtitle sprintf('%s