Skip to content

Instantly share code, notes, and snippets.

@takaki
Last active December 11, 2015 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takaki/4528081 to your computer and use it in GitHub Desktop.
Save takaki/4528081 to your computer and use it in GitHub Desktop.
Encode.pm sample
#!/usr/bin/perl
#
use strict;
use Encode qw(decode encode from_to);
use Data::Dumper;
open IN, 'euc.txt';
while(<IN>){
my $euc = $_;
my $string = decode('euc-jp', $euc);
my $utf8 = encode('utf-8', $string);
print $euc;
print $string;
print $utf8;
print Dumper($euc);
print Dumper($string);
print Dumper($utf8);
from_to($_, 'euc-jp', 'utf-8');
print;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment