Those worked. Thanks.<br><br><div class="gmail_quote">On Mon, May 16, 2011 at 3:54 PM, Lorenz Quack <span dir="ltr">&lt;<a href="mailto:don@amberfisharts.com">don@amberfisharts.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Thomas,<br>
<br>
what about either:<br>
<br>
blah=foo.decrypt(baz).decode(&quot;utf-8&quot;)<br>
<br>
or<br>
<br>
blah=unicode(foo.decrypt(baz), &quot;utf-8&quot;)<br>
<br>
cheers,<br>
Lorenz<br>
<div><div></div><div class="h5"><br>
On 05/16/2011 09:18 PM, Thomas Knox wrote:<br>
&gt; Hello,<br>
&gt;<br>
&gt; 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.<br>
&gt; For example:<br>
&gt;<br>
&gt; from Crypto.Cipher import AES<br>
&gt; foo = AES.new(&#39;a1b2c3d4e5f6g7h8&#39;, AES.MODE_ECB)<br>
&gt; bar=u&#39;&#39;<br>
&gt; for i in range(0,16):<br>
&gt;      bar+=unichr(255)<br>
&gt; # At this point, bar is<br>
&gt; # u&#39;\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff&#39;<br>
&gt; baz=foo.encrypt(bar.encode(&#39;utf-8&#39;))<br>
&gt; blah=foo.decrypt(baz)<br>
&gt; # baz is now<br>
&gt; #<br>
&gt; &#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>
&gt;<br>
&gt; How can I get encrypt and decrypt to use UTF gracefully?<br>
&gt;<br>
&gt; Thank you,<br>
&gt; Tom<br>
&gt;<br>
&gt;<br>
<br>
</div></div>_______________________________________________<br>
pycrypto mailing list<br>
<a href="mailto:pycrypto@lists.dlitz.net">pycrypto@lists.dlitz.net</a><br>
<a href="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto" target="_blank">http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto</a><br>
</blockquote></div><br>