From: timriker Date: Mon, 28 Apr 2008 18:16:02 +0000 (+0000) Subject: handle reverse maps once utf8 support is fixed X-Git-Url: https://git.donarmstrong.com/?p=infobot.git;a=commitdiff_plain;h=1b325d96346dbd17a6c8c2a99bdd63ddb6ab70f7 handle reverse maps once utf8 support is fixed git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1814 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/Modules/upsidedown.pl b/src/Modules/upsidedown.pl index 81c6e05..751d298 100644 --- a/src/Modules/upsidedown.pl +++ b/src/Modules/upsidedown.pl @@ -126,7 +126,13 @@ sub turnedstr { my $turned = ''; my $tlength = 0; + # add reverse mappings + foreach my $up (keys %updown) { + $updown{$updown{$up}} = $up if ! exists $updown{$updown{$up}}; + } + for my $char ( $str =~ /(\X)/g ) { +#print STDERR "str=\"$str\" char=\"$char\"\n"; if ( exists $updown{$char} ) { my $t = $updown{$char}; $t = $missing if !length($t); @@ -153,6 +159,8 @@ sub upsidedown { &::performStrictReply( turnedstr( $message ) ); } +#binmode(STDERR, "encoding(UTF-8)"); +#print STDERR turnedstr("upsidedown ɟǝpɔqɐabcdef") . "\n"; 1; # vim:ts=4:sw=4:expandtab:tw=80