Changeset 1975

Show
Ignore:
Timestamp:
09/26/06 03:35:30
Author:
miyagawa
Message:

decode ARGV using Term::Encoding

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • misc/30boxes.pl

    r1974 r1975  
    3030$ua->env_proxy; 
    3131 
    32 my $encoding; 
    33 eval { 
    34     require Term::Encoding; 
    35     $encoding = Term::Encoding::get_encoding(); 
    36 }; 
    37 $encoding ||= "utf-8"; 
    38 binmode STDOUT, ":encoding($encoding)"; 
    39 binmode STDIN, ":encoding($encoding)"; 
    40  
    4132main(); 
    4233 
     
    5142} 
    5243 
     44sub setup_encoding { 
     45    my $encoding; 
     46    eval { 
     47        require Term::Encoding; 
     48        $encoding = Term::Encoding::get_encoding(); 
     49    }; 
     50    $encoding ||= "utf-8"; 
     51    binmode STDOUT, ":encoding($encoding)"; 
     52    binmode STDIN, ":encoding($encoding)"; 
     53    @ARGV = decode($encoding, $_), @ARGV; 
     54} 
     55 
    5356sub main { 
     57    setup_encoding(); 
    5458    GetOptions(\%args, 
    5559               "start=s",