[Python-bugs-list] [ python-Bugs-669486 ] md5.new(unicode) fails, sha1 also

SourceForge.net noreply@sourceforge.net
Thu, 16 Jan 2003 16:43:12 -0800


Bugs item #669486, was opened at 2003-01-16 16:43
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=669486&group_id=5470

Category: Unicode
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Martin D Katz, Ph.D. (drbits)
Assigned to: M.-A. Lemburg (lemburg)
Summary: md5.new(unicode) fails, sha1 also

Initial Comment:
Some library modules appear to choke on Unicode strings
that cannot be converted to the default encoding. It
appears that the functions in the modules are getting a
character array that has been encoded from Unicode to
the default encoding (ascii in my case) before being
passed. The data should just be passed as an array of
bytes, encoding it first is not appropriate for modules
like md5 and sha.

Thus:
>>> import md5
>>> m = md5.new(u'\x80')
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
UnicodeError: ASCII encoding error: ordinal not in
range(128)

This is in Windows 2000 (both sp1 or sp3). Using
ActiveState python 2.2.1 (build 222)

Martin Katz, Ph.D.
Tapstone, Inc.
mkatz@tapstone.com


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=669486&group_id=5470