diff options
-rwxr-xr-x | localkannel-dispatch | 14 |
1 files changed, 11 insertions, 3 deletions
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 |