Changeset e4e7407 in lab.git for misc


Ignore:
Timestamp:
Jan 25, 2013 12:11:26 AM (12 years ago)
Author:
mitty <mitty@…>
Branches:
master, trunk
Children:
0e3de64
Parents:
89fbc5d
Message:
  • fix: use Encode to correctly handle utf9 file or directory name
  • NFKC replaces much more than expected

git-svn-id: https://lab.mitty.jp/svn/lab/trunk@192 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • misc/findcombinable.pl

    r89fbc5d re4e7407  
    55use utf8; 
    66 
     7use Encode; 
    78use Unicode::Normalize qw(NFC NFKC); 
     9binmode STDOUT => 'encoding(utf8)'; 
     10binmode STDERR => 'encoding(utf8)'; 
    811 
    912my $top = shift @ARGV || exit; 
    1013if (! -d $top) { exit; } 
     14 
     15my $utf8 = find_encoding("utf8"); 
     16$top = $utf8->decode($top); 
    1117 
    1218checkdir($top); 
     
    1622     
    1723    if ($str ne NFC($str)) { 
    18         return 1; 
    19     } 
    20     if ($str ne NFKC($str)) { 
    2124        return 1; 
    2225    } 
     
    3639    while (my $entry = shift @entries) { 
    3740        next if ($entry =~ /^\.+$/); 
     41        $entry = $utf8->decode($entry); 
    3842        if (match($entry)) { 
    3943            print "'$target/$entry' can be composed\n"; 
Note: See TracChangeset for help on using the changeset viewer.