On Sat, Mar 17, 2007 at 02:53:17AM -0500, Rich Felker wrote:
: On Sat, Mar 17, 2007 at 07:05:01AM +0000, Colin Paul Adams wrote:
: > I can't find this in the GNOME help, so I thought I'd try asking here.
: > 
: > I want to be rename a file so it has an a-umlaut (lower case) in the
: > name.
: > 
: > My LANG is en_GB.UTF-8.
: > 
: > I don't know how to type the accented character.
: 
: One sure way is to copy-and-paste it from a file already containing
: the character. I keep around a copy of UnicodeData.txt with the
: literal UTF-8 character added to each line for exactly this purpose.

Here's a handy program to grep out names from the unicode database.
I call it "uni".

#!/usr/bin/perl -C

binmode STDOUT, ":utf8";
$pat = "@ARGV";
if (ord $pat > 256) {
    $pat = sprintf("%04x", ord $pat);
    print "That's $pat...\n";
    $pat = '^' . $pat;
}
elsif (ord $pat > 128) {        # arg in sneaky UTF-8
    $pat = sprintf("%04x", unpack("U0U",$pat));
    print "That's $pat...\n";
    $pat = '^' . $pat;
}

@names = split /^/, do 'unicore/Name.pl';
for my $line (@names) {
    $hex = hex($line);
    $_ = chr($hex)."\t".$line;
    if (/$pat/io) {
        print;
    }
}

For example, typing "uni ing face" produces:

☹       2639            WHITE FROWNING FACE
☺       263A            WHITE SMILING FACE
☻       263B            BLACK SMILING FACE

Larry

--
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/linux-utf8/

Reply via email to