Skip to content

Instantly share code, notes, and snippets.

@tomcha
Last active December 22, 2015 10:29
Show Gist options
  • Save tomcha/6459410 to your computer and use it in GitHub Desktop.
Save tomcha/6459410 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
#use utf8;
use Data::Dumper;
binmode STDIN,":utf8";
binmode STDOUT,":utf8";
binmode STDERR,":utf8";
chomp(my $filename = 'euc.txt');
open my $fh,"<",$filename;
#binmode $fh,":encoding(euc-jp)";
binmode $fh,":encoding(utf8)";
my @lines = <$fh>;
close $fh;
for my $line (@lines){
print $line;
}
open my $fhw,">","utf8.txt" or die;
binmode $fhw,":utf8";
print $fhw @lines;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment