Commits

David Larlet  committed 0e88acb

Finally fallback to Charade if the encoding is not specified in the meta tag, thanks Lukasa and SigmaVirus24 on IRC, refs #1

  • Participants
  • Parent commits 4f98b62

Comments (0)

Files changed (1)

File src/browser.py

             # Warning: response.text MUST be reevaluated
             encoding = re.findall(meta_encoding_re, response.text)
             if encoding:
-                response.encoding = encoding[0] or response.encoding
+                response.encoding = encoding[0]
+            else:  # guess from Charade as a final fallback
+                response.encoding = response.apparent_encoding
         document = BrowserDocument(response.text)
 
         # Explicitely parse the HTML to be able to rewrite links