erikrose/chardet — pull request #1 by abadger (2012-09-10 17:26:42+00:00)
Title: Make BOM signature strings byte strings

... for X-ISO-10646-UCS-4-2143 and X...-ISO-10646-UCS-4-3412.

Testing my library that uses chardet on python-2.4 with chardet-1.1 I get this traceback:

======================================================================
ERROR: test_guess_encoding_with_chardet_installed (test_text_misc.TestTextMisc)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/toshio/kitchen/kitchen-1.1.2a1/tests/test_text_misc.py", line 43, in test_guess_encoding_with_chardet_installed
misc.guess_encoding(self.euc_jp_japanese)) == self.u_japanese)
File "/home/fedora/toshio/kitchen/kitchen-1.1.2a1/kitchen/text/misc.py", line 91, in guess_encoding
detection_info = chardet.detect(byte_string)
File "/home/fedora/toshio/kitchen/lib/python2.4/site-packages/chardet/__init__.py", line 24, in detect
u.feed(aBuf)
File "/home/fedora/toshio/kitchen/lib/python2.4/site-packages/chardet/universaldetector.py", line 90, in feed
if aBuf[:len(chunk)] == chunk:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128)

This pull request fixes that by changing the BOM signature strings for two UCS-4 signatures into byte strings (str) instead of unicode.