Permalink
Browse files

Some feeds include a misplaced BOM, gotta ignore 'em

  • Loading branch information...
Joachim Robert
Joachim Robert committed Oct 24, 2018
1 parent 815ee5e commit 3d42ff32b3aeb3bdbe32125540416e64b3c27451
Showing with 4 additions and 0 deletions.
  1. +4 −0 feed_worker.py
@@ -193,6 +193,10 @@ def import_feed(url, ignore_date = False):
# Empty response raises all hell
return False
# check if a BOM is at the start of the file, like http://www.wizards.com/dnd/rsspodcast.xml
if response.text[0] == u'\ufeff' or response.text[0] == u'\xef': # bytes \xef\xbb\xbf in utf-8 encoding
response.encoding = 'utf-8-sig'
response_content_type = response.headers.get('content-type', '').split(';')[0]
# create the feed object

0 comments on commit 3d42ff3

Please sign in to comment.