Skip to content

Instantly share code, notes, and snippets.

@TimToady
Created May 1, 2012 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TimToady/2571294 to your computer and use it in GitHub Desktop.
Save TimToady/2571294 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
binmode STDIN, ":utf8";
binmode STDOUT, ":utf8";
binmode STDERR, ":utf8";
eval { binmode STD, ":utf8" };
use Encode;
for (@ARGV) { Encode::_utf8_on($_) }
$pat = "@ARGV";
if (ord $pat > 256) {
$pat = sprintf("%04x", ord $pat);
$pat = '\b' . $pat . '\b';
}
elsif (ord $pat > 128) { # arg in sneaky UTF-8
$pat = sprintf("%04x", unpack("U0U",$pat));
$pat = '\b' . $pat . '\b';
}
@names = split /^/, do 'unicore/Name.pl';
for my $line (@names) {
$hex = hex($line);
$_ = chr($hex)."\t".$line;
if (/$pat/io) {
print 'o' if /COMBINING/;
print;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment