From 71c63873d51e566f8de5480ba930707b51bb8575 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 25 Sep 2010 21:18:01 +0200 Subject: Replace simpleword() with lctransliterate(). --- localkannel-dispatch | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'localkannel-dispatch') diff --git a/localkannel-dispatch b/localkannel-dispatch index bbfe891..62321c2 100755 --- a/localkannel-dispatch +++ b/localkannel-dispatch @@ -18,8 +18,16 @@ exit1() { exit 1 } -simpleword() { - echo "$1" | perl -ne '/([a-zæøåÆØÅ!@\/][a-zæøåÆØÅ0-9-]+)/i and print lc($1)' +# Based on Text::Unidecode bug#8017: http://rt.cpan.org/Ticket/Display.html?id=8017#txn-322351 +lctransliterate() { + echo "$1" | perl -C1 -n \ + -e 'use Text::Unidecode;' \ + -e 'use Encode 2.12 qw(encode decode _utf8_off);' \ + -e 'print lc(decode("GSM0338", encode("GSM0338", $_,' + -e 'sub {$a=unidecode(chr $_[0]); _utf8_off($a); $a;}' + -e ')));' + + return $res; } uriunescape() { @@ -51,7 +59,7 @@ to=`uriunescape "$1"`; shift set -- `uriunescape "$@" | sed -e 's/\+/ /g'` #set -- `uriunescape "$@"` app_raw="$1" -app=`simpleword "$1"`; shift +app=`lctransliterate "$1"`; shift export debug -- cgit v1.2.3