Python - ROT13 encode
"ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple letter substitution cipher that replaces a letter with the letter 13 letters after it in the alphabet. ROT13 is an example of the Caesar cipher, developed in ancient Rome." ~Wikipedia. Here are 2 solutions to implement ROT13 in Python: 0. 1st solution: import string ROT13 = string.maketrans(\ "ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz",\ "NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm") def rot13_encode (user_text): return string.translate(user_text, ROT13) This method works smoothly in the console but when using with the web it will raise error because of some special characters in the input: File "/usr/lib/python27/string.py" , line 498 , in translate return s . translate ( table + s [: 0 ]) UnicodeDecodeError : 'ascii' codec can 't decode byte 0x80...