11 maj 2009

konwersja utf8 na katakana

sub UTF8toKatakana
# convert utf8 to katakana
{
my ( $stri ) = @_;

$stri =~ s/\xC4\x85/a/g;    # ą
$stri =~ s/\xC4\x84/A/g;    # Ą
$stri =~ s/\xC4\x87/c/g;    # ć
$stri =~ s/\xC4\x86/C/g;    # Ć
$stri =~ s/\xC4\x99/e/g;    # ę
$stri =~ s/\xC4\x98/E/g;    # Ę
$stri =~ s/\xC5\x82/l/g;    # ł
$stri =~ s/\xC5\x81/L/g;    # Ł
$stri =~ s/\xC3\xB3/o/g;    # ó
$stri =~ s/\xC3\x93/O/g;    # Ó
$stri =~ s/\xC5\x9B/s/g;    # ś
$stri =~ s/\xC5\x9A/S/g;    # Ś
$stri =~ s/\xC5\xBC/z/g;    # ż
$stri =~ s/\xC5\xBB/Z/g;    # Ż
$stri =~ s/\xC5\xBA/z/g;    # ź
$stri =~ s/\xC5\xB9/Z/g;    # Ź
$stri =~ s/\xc5\x84/n/g;    # ń
$stri =~ s/\xc5\x83/N/g;    # Ń

return $stri;
}
&UTF8toKatakana($calosc);