Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

Commit

Permalink
Ensure the encoding reported by chardet is unicode
Browse files Browse the repository at this point in the history
Fixes issue 323. Thanks to Barry Warsaw for reporting this!

git-svn-id: http://feedparser.googlecode.com/svn/trunk@680 73d2b349-402e-0410-baf4-070fd12ab5b7
  • Loading branch information
kurtmckee committed Feb 5, 2012
1 parent 4268fab commit 6e2a1f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -6,6 +6,7 @@ Changes coming in the next release:
* Issue 313 (include the compression test files in MANIFEST.in)
* Issue 315 (HTTP server for unit tests runs on 0.0.0.0)
* Issue 321 (malformed URIs can cause ValueError to be thrown)
* Issue 323 (installing chardet causes 11 unit test failures)
* Issue 325 (map `description_detail` to `summary_detail`)

5.1 - December 2, 2011
Expand Down
2 changes: 1 addition & 1 deletion feedparser/feedparser.py
Expand Up @@ -3839,7 +3839,7 @@ def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, refer
break
# if no luck and we have auto-detection library, try that
if (not known_encoding) and chardet:
proposed_encoding = chardet.detect(data)['encoding']
proposed_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
if proposed_encoding and (proposed_encoding not in tried_encodings):
tried_encodings.append(proposed_encoding)
try:
Expand Down

0 comments on commit 6e2a1f9

Please sign in to comment.