Re: unicode and hashlib

2008-11-29 Thread Jeff H
On Nov 28, 1:24 pm, Scott David Daniels [EMAIL PROTECTED] wrote: Jeff H wrote: hashlib.md5 does not appear to like unicode,   UnicodeEncodeError: 'ascii' codec can't encode character u'\xa6' in position 1650: ordinal not in range(128) After googling, I've found BDFL and others on Py3K

Re: unicode and hashlib

2008-11-29 Thread Jeff H
On Nov 28, 2:03 pm, Terry Reedy [EMAIL PROTECTED] wrote: Jeff H wrote: hashlib.md5 does not appear to like unicode,   UnicodeEncodeError: 'ascii' codec can't encode character u'\xa6' in position 1650: ordinal not in range(128) It is the (default) ascii encoder that does not like non-ascii

Re: unicode and hashlib

2008-11-29 Thread Jeff H
On Nov 29, 8:27 am, Jeff H [EMAIL PROTECTED] wrote: On Nov 28, 2:03 pm, Terry Reedy [EMAIL PROTECTED] wrote: Jeff H wrote: hashlib.md5 does not appear to like unicode,   UnicodeEncodeError: 'ascii' codec can't encode character u'\xa6' in position 1650: ordinal not in range(128

Re: unicode and hashlib

2008-11-29 Thread Jeff H
On Nov 29, 12:23 pm, Scott David Daniels [EMAIL PROTECTED] wrote: Scott David Daniels wrote: ... If you now, and for all time, decide that the only source you will take is cp1252, perhaps you should decode to cp1252 before hashing. Of course my dyslexia sticks out here as I get encode

unicode and hashlib

2008-11-28 Thread Jeff H
hashlib.md5 does not appear to like unicode, UnicodeEncodeError: 'ascii' codec can't encode character u'\xa6' in position 1650: ordinal not in range(128) After googling, I've found BDFL and others on Py3K talking about the problems of hashing non-bytes (i.e. buffers)