Changeset 35131 for platform

Show
Ignore:
Timestamp:
08/30/09 18:01:18 (4 years ago)
Author:
kazuhiko
Message:

support Ruby-1.9.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • platform/tdiary/util/estraier-search/estraier-search.rb

    r31683 r35131  
    11#!/usr/bin/env ruby 
     2# -*- coding: utf-8; -*- 
    23# estraier-search.rb $Revision: 1.1.2.12 $ 
    34# 
     
    56# You can redistribute it and/or modify it under GPL2. 
    67# 
    7 $KCODE= 'u' 
    88BEGIN { $stdout.binmode } 
     9begin 
     10        Encoding::default_external = 'UTF-8' 
     11rescue NameError 
     12        $KCODE = 'n' 
     13end 
    914 
    1015require "estraierpure" 
     
    117122                        end 
    118123                        query = "[SIMILAR]" 
    119                         item.keywords.split(/\t/).enum_slice(2).collect do |k, s| 
     124                        item.keywords.split(/\t/).each_slice(2).collect do |k, s| 
    120125                                query << " WITH #{s} #{k}" 
    121126                        end 
     
    242247                body = conf.to_mobile( tdiary.eval_rhtml( 'i.' ) ) 
    243248                head['charset'] = conf.mobile_encoding 
    244                 head['Content-Length'] = body.size.to_s 
     249                head['Content-Length'] = body.bytesize.to_s 
    245250        else 
    246251                if @cgi['type'] == 'rss' 
     
    251256                end 
    252257                head['charset'] = conf.encoding 
    253                 head['Content-Length'] = body.size.to_s 
     258                head['Content-Length'] = body.bytesize.to_s 
    254259                head['Pragma'] = 'no-cache' 
    255260                head['Cache-Control'] = 'no-cache'