#!/usr/bin/perl
use Encode;
binmode(STDIN, ':encoding(big5)');
binmode(STDOUT, ':encoding(big5)');
binmode(STDERR, ':encoding(big5)');
use Cwd;
my $cwd = getcwd;
@ls = `LC_ALL=zh_TW.Big5 LANGUAGE=zh_TW.Big5 LANG=zh_TW.Big5 /bin/ls -1R --hide="[a-z]*[0-9]*.*" .`;
$last_dir = ".";
foreach my $file (@ls) {
chomp $file;
$big5 = encode("cp950", $file);
if ($big5 =~ m/:$/) {
chop $big5;
$last_dir = "$big5";
}
elsif ($file ne $big5) {
chdir $last_dir;
rename $file, $big5;
chdir $cwd;
}
}
2007/03/19
UTF-8 to big5 轉碼程式
底下貼上修改自上一篇,utf-8 轉 big5 的程式片斷。
訂閱:
張貼留言 (Atom)
0 意見:
張貼留言