perl-unicode

UTF-8 case conversion

2003-09-03 04:30:06

The perlunicode POD tells me the following

        lc(), uc(), lcfirst(), and ucfirst() work for the following cases:

                the case mapping is from a single Unicode
                character to another single Unicode character, or

                the case mapping is from a single Unicode
                character to more than one Unicode character.

        The following cases do not yet work:

                the "final sigma" (Greek), and

                anything to with locales (Lithuanian, Turkish, Azeri).

I wrote a small script (see below), trying to transform ÖRJAN
LUNDSTRÖM into Örjan Lundström, but it seems to fail, probably because
of locale related problems. My question is then simply. How do I do
this then?

Sigfrid

----------
Test script:


#!/usr/bin/perl -w

use strict;
use Encode 'from_to';

my $orjan = 'ÖRJAN';
my $lundstrom = 'LUNDSTRÖM';

print $orjan . ' ' . $lundstrom . "\n";

from_to $orjan,'latin1','utf-8';
from_to  $lundstrom,'latin1','utf-8';

print $orjan . ' ' . $lundstrom . "\n";

print ucfirst( lc $orjan ) . ' ' . ucfirst (lc $lundstrom ) . "\n";





<Prev in Thread] Current Thread [Next in Thread>