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