Changeset 492

Show
Ignore:
Timestamp:
04/02/06 12:24:17
Author:
miyagawa
Message:

fixed usage of Encode::Guess

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Util.pm

    r487 r492  
    4646    # xxx it supports Japanese only 
    4747    my @guess = qw(utf-8 euc-jp shift_jis); 
    48     $charset = guess_encoding($content, @guess); 
     48    $charset ||= eval { guess_encoding($content, @guess)->name }; 
     49 
     50    # 4) falls back to UTF-8 
     51    $charset ||= 'utf-8'; 
    4952 
    5053    return Encode::decode($charset, $content);