Tkinter md5 problem

Jeff Epler jepler at unpythonic.net
Sat Dec 28 13:49:21 EST 2002


On Sat, Dec 28, 2002 at 12:57:20PM +0000, Dagur Páll Ammendrup wrote:
> So what can I do?

Convert the unicode string to an 8-bit encoding of your choice.  If you
want to be able to compute a signature for any string, you should
use utf-8.  If you want to match signatures computed for strings in
a particular encoding (such as latin-1, etc) use that coding
instead.

eg
u"\u00c0".encode("latin-1") -> "\xc0"
u"\u00c0".encode("utf-8") -> "\xc3\x80"
u"\u00c0".encode("iso8859-2") -> UncodeError
(there's no LATIN CAPITAL LETTER A WITH GRAVE in iso8859-2)

Jeff




More information about the Python-list mailing list