Hello,<br><br>I'm building an application in Python 2.7.1 using PyCrypto 2.3, and it's behaving badly with utf-8 and utf-16 strings. For example:<br><br>from Crypto.Cipher import AES<br>foo = AES.new('a1b2c3d4e5f6g7h8', AES.MODE_ECB)<br>
bar=u''<br>for i in range(0,16):<br> bar+=unichr(255)<br># At this point, bar is<br># u'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'<br>baz=foo.encrypt(bar.encode('utf-8'))<br>
blah=foo.decrypt(baz)<br># baz is now<br># '\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf\xc3\xbf'<br><br>How can I get encrypt and decrypt to use UTF gracefully?<br>
<br>Thank you,<br>Tom<br>