Years ago I wrote a "scriptlet" (plug-in Perl module code called via a higher-level driver program). Can this idea help for mappings?
Code: -------------------- package Uni2Ascii; # Transliterates Unicode input into its approximate ASCII equivalent in terms of pronunciation. # # Requirements # All: # Install the Perl module(s): # cpan Text::Unidecode # # Example - converts: # # l'été est arrivé à peine après aôut # ¿España es un paìs muy lindo? # some special chars: » « ® ¼ ¶ Ṉ # Some greek letters: β ÷ Θ ¬ the α and ω (or is it Ω?) # hiragana? みせる です # Здравствуйте # السلام عليكم # # into: # # l'ete est arrive a peine apres aout # ?Espana es un pais muy lindo? # some special chars: >> << (r) 1/4 P - - -- N # Some greek letters: b / Th ! the a and o (or is it O?) # hiragana? miseru desu # Zdravstvuitie # lslm `lykm use v5.16; use strict; use warnings; use utf8; use Utils::Misc; use Text::Unidecode; binmode STDOUT, ":utf8"; binmode STDERR, ":utf8"; $DB::single = 1; our %scripthooks = ( pre => undef, perfile => \&do_perfile, post => undef, ); # Add any additional transliterations as pairs (old => new). # Here as some example (and default) overrides. my @additional = ( '∏' => 'N-Ary Product', '∐' => 'N-Ary Coproduct', 'ട' => 's', 'ധ' => 'w', ); sub do_perfile { my ($field, $row) = @_; return uni_to_ascii($row->{$field}); } sub uni_to_ascii { $_ = shift; # Apply the additional transliterations while(my ($old,$new) = splice(@additional,0,2)) { s/$old/$new/g; } my $ret = unidecode $_; debug("$_ --> ", $ret); return $ret; } -------------------- ------------------------------------------------------------------------ MrC's Profile: http://forums.slimdevices.com/member.php?userid=468 View this thread: http://forums.slimdevices.com/showthread.php?t=110147
_______________________________________________ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter