]> git.donarmstrong.com Git - infobot.git/commitdiff
handle reverse maps once utf8 support is fixed
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Mon, 28 Apr 2008 18:16:02 +0000 (18:16 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Mon, 28 Apr 2008 18:16:02 +0000 (18:16 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1814 c11ca15a-4712-0410-83d8-924469b57eb5

src/Modules/upsidedown.pl

index 81c6e0521678451047dada01cfcfd7482a4b1d56..751d298d22f9165f33b4682f6a1faeee8ea816a8 100644 (file)
@@ -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