Changeset 131

Show
Ignore:
Timestamp:
02/24/06 07:21:55
Author:
ko
Message:

changed work for encode.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Search/Rast.pm

    r130 r131  
    2222 
    2323    my $dir = $self->conf->{dir}; 
    24     $self->{encode} = $self->conf->{encode} || 'utf8'; 
     24    $self->{encode} = $self->conf->{encode} eq 'euc_jp' ? 'euc_jp' : 'utf8'; 
    2525 
    2626    unless (-e $dir && -d _) { 
     
    6767        Plagger->context->log(info => "create index $dir"); 
    6868    } 
    69  
    70     #euc_jp to euc-jp 
    71     $self->{encode} =~ s/_/-/; 
    7269    $self->{rast} = Rast->open($dir, RAST_DB_RDWR); 
    7370} 
     
    118115sub convert { 
    119116    my ($self, $str) = @_; 
    120     $str = encode($self->{encode}, $str) unless $self->{encode} eq 'utf8'
    121     $str
     117    utf8::decode($str) unless utf8::is_utf8($str)
     118    return encode($self->{encode}, $str)
    122119} 
    123120