Bugs item #1601501, was opened at 2006-11-23 03:38
Message generated for change (Comment added) made by doerwalter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1601501&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
>Status: Closed
Resolution: Accepted
Priority: 5
Private: No
Submitted By: bazwal (bazwal)
Assigned to: Nobody/Anonymous (nobody)
Summary: utf_8_sig decode fails with buffer input
Initial Comment:
when the decode function in encodings.utf_8_sig receives a buffer object, it
fails because it tries to check for a bom using startswith:
>>> unicode('\xef\xbb\xbf', 'utf_8_sig')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.5/encodings/utf_8_sig.py", line 19, in decode
if input.startswith(codecs.BOM_UTF8):
AttributeError: 'buffer' object has no attribute 'startswith'
the test should be changed to:
if input[:3] == codecs.BOM_UTF8:
----------------------------------------------------------------------
>Comment By: Walter Dörwald (doerwalter)
Date: 2006-11-23 06:06
Message:
Logged In: YES
user_id=89016
Originator: NO
Fixed in r52827 for the 2.5 branch
----------------------------------------------------------------------
Comment By: Walter Dörwald (doerwalter)
Date: 2006-11-23 06:04
Message:
Logged In: YES
user_id=89016
Originator: NO
Oops, I missed your stacktrace. Fixed in r52826.
(A better fix might be to add startswith() to buffer).
----------------------------------------------------------------------
Comment By: Walter Dörwald (doerwalter)
Date: 2006-11-23 05:00
Message:
Logged In: YES
user_id=89016
Originator: NO
Can you provide a test that fails?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1601501&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com