Skip to content

Instantly share code, notes, and snippets.

@jin1016
Created December 14, 2013 12:45
Show Gist options
  • Save jin1016/7958752 to your computer and use it in GitHub Desktop.
Save jin1016/7958752 to your computer and use it in GitHub Desktop.
カレントディレクトリの.tjs/.ks ファイルを sjis から utf-8 に一括変換する perl スクリプト
use utf8;
use Encode;
my $output ="tmp_output_file.tmp";
@ext = ("*.tjs", "*.ks");
foreach( @ext ) {
foreach( glob($_) ) {
my $input = $_;
open (IN, "<:encoding(shift_jis)", $input) or die "$!";
open (OUT, ">:utf8", $output) or die "$!";
while( <IN> ) {
print OUT $_;
}
close(IN);
close(OUT);
unlink $input;
rename $output, $input;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment