diff options
author | Jonas Smedegaard <dr@jones.dk> | 2010-09-25 21:18:01 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2010-09-25 21:18:01 +0200 |
commit | 71c63873d51e566f8de5480ba930707b51bb8575 (patch) | |
tree | f44f91b697c77012b9b1d79f1cf56d22bae91937 /localkannel-dispatch | |
parent | 23ce868faa3c8e90e48fdd826e1d4b76c7b7597c (diff) |
Replace simpleword() with lctransliterate().
Diffstat (limited to 'localkannel-dispatch')
-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 |