Issue 1601501: utf_8_sig decode fails with buffer input (original) (raw)
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 "", line 1, in 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: