1
|
1 #!/usr/bin/perl
|
|
2
|
|
3 # find used unicode
|
|
4 use strict;
|
|
5 use utf8;
|
|
6 use open qw(:std :utf8); # input/output default encoding will be UTF-8, it looks like default
|
|
7
|
|
8 my %used;
|
|
9
|
|
10 while(<>) {
|
|
11 for my $ch ( /(.)/g ) {
|
2
|
12 next if (ord($ch)<128);
|
|
13 next if (ord($ch)>12288); # ignore CJKV
|
1
|
14 $used{ord($ch)}++;
|
|
15 }
|
|
16 }
|
|
17
|
2
|
18 for my $bdf (<[0-9]*.bdf>) {
|
1
|
19 open(my $f,"<",$bdf);
|
|
20 my %has;
|
|
21 while(<$f>) {
|
|
22 if (/^ENCODING\s+(\d+)/) {
|
|
23 my $encoding=$1;
|
|
24 $has{$encoding} = 1;
|
|
25 }
|
|
26 }
|
|
27 my %no;
|
|
28 for my $ch ( keys %used ) {
|
|
29 $no{$ch} ++ if (! defined $has{$ch}) ;
|
|
30 }
|
|
31 for my $ch ( sort {$a<=>$b} keys %no ) {
|
2
|
32 my $hex = sprintf("%x",$ch);
|
|
33 print chr($ch)," $ch 0x$hex is not in $bdf\n";
|
1
|
34 }
|
|
35 }
|