Created
July 25, 2011 07:44
-
-
Save aero/1103723 to your computer and use it in GitHub Desktop.
Rename MacOS X NFD hangule to NFC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# 사용법 | |
# perl demacboogi.pl *.zip #zip파일만 변환 | |
# perl demacboogi.pl #모든파일 변환 | |
use 5.010; | |
use strict; | |
use warnings; | |
use Encode qw/encode decode/; | |
use Unicode::Normalize qw/compose/; | |
use File::Copy; | |
my @files = @ARGV; | |
@files = glob('*') if @files == 0; | |
foreach my $file (@files) { | |
my $from = decode('utf8', $file); | |
my $to = compose($from); | |
if ($from ne $to) { | |
say encode('utf8', "move $from -> $to"); | |
move($from, $to); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment