| Lingua-Multinational-Translit-ICAO documentation | Contained in the Lingua-Multinational-Translit-ICAO distribution. |
Lingua::Multinational::Translit::ICAO -- Multinational characters transliteration into ICAO Doc 9303
use Lingua::Multinational::Translit::ICAO qw/ ml2icao /;
print ml2icao('word', 'iso-8859-1');
Lingua::Multinational::Translit::ICAO can be used for transliteration of multinational characters in conformance with ICAO Doc 9303 Recommendations.
This method converts $string from multinational character set to ICAO transliteration.
Optional $encoding parameter allows to specify $string's encoding (default is 'utf-8')
Serguei Trouchelle <stro@railways.dp.ua>
Copyright (c) 2007-2009 Serguei Trouchelle. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Lingua::Cyrillic::Translit::ICAO -- Cyrillic characters transliteration into ICAO Doc 9303
| Lingua-Multinational-Translit-ICAO documentation | Contained in the Lingua-Multinational-Translit-ICAO distribution. |
# Lingua/Multinational/Translit/ICAO.pm # # $Id: ICAO.pm 6 2009-09-16 15:37:46Z stro $ # # Copyright (c) 2007-2009 Serguei Trouchelle. All rights reserved. # # This program is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # History: # 1.05 2009/09/16 Changed 5.8.0 to 5.008 # 1.04 2007/07/07 use Encode in preference of Text::Iconv (thanks to Nikita Dedik) # Rate Text::Iconv Encode # Text::Iconv 13243/s -- -41% # Encode 22386/s 69% -- # 1.02 2007/07/05 use 5.8.0 added # 1.01 2007/07/04 Initial revision
package Lingua::Multinational::Translit::ICAO; require Exporter; use Config; use strict; use warnings; use 5.008; use utf8; use Encode; our @EXPORT = qw/ /; our @EXPORT_OK = qw/ ml2icao /; our %EXPORT_TAGS = qw / /; our @ISA = qw/Exporter/; our $VERSION = '1.05'; my $table = q!1 1 à A à A à A à AE à A Ä A à AA Ä A Ä A á a à a â a ä ae ã a Ä a Ã¥ aa Ä a Ä a Ä C Ä c Ä C Ä c Ä C Ä c Ä C Ä c à C ç c Ä D Ä d Ä D Ä d à E à E à E à E é e è e ê e ë e Ä E Ä e Ä E Ä e Ä E Ä e Ä E Ä e Ä E Ä e Ä G Ä g Ä G Ä g Ä G Ä¡ g Ä¢ G Ä£ g Ħ H ħ h Ĥ H Ä¥ h ı i à I à I à I à I İ I Ĩ I Ä© i Ī I Ä« i Ĭ I Ä i Ä® I į i Ä´ J ĵ j Ķ K Ä· k Å L Ĺ L Ľ L Ä» L Ä¿ L Å l ĺ l ľ l ļ l Å l Å N Å N Å N Å N Å n Å n Å n Å n ñ n à N à OE à O à O à O à OE à O ó o ò o ô o õ o ö oe Å O Å o Å O Å o Å O Å o Å R Å r Å R Å r Å R Å r Å S Å S Å S Å S Å s Å s Å s Å¡ s Ŧ T Ť T Å¢ T ŧ t Å¥ t Å£ t à U à U à U à UE ú u ù u û u ü ue Ũ U Ŭ U Ű U Å® U Ū U Ų U Å© u Å u ű u ů u Å« u Å´ W ŵ w Ŷ Y Å· y Ź Z ź z Ž Z ž z Å» Z ż z à Y ý y Ÿ Y à TH à AE æ ae þ th IJ IJ ij ij Å OE Å oe à SS 2 2!; our %ml2icao = split /\s+/, $table;
sub ml2icao { my $val = shift; my $lang = shift; my $enc = shift; if ($enc) { $val = Encode::decode($enc, $val); } # else think of utf-8 utf8::decode($val); my $res = ''; foreach (0 .. length $val) { $_ = substr($val, $_, 1); $_ = $ml2icao{$_} if defined $ml2icao{$_}; $res .= $_; } return $res; } 1;