fix wrong encoding detection logic

This commit is contained in:
smurail 2014-10-22 11:31:11 +02:00 committed by Florent
commit 137590e819

View file

@ -137,8 +137,9 @@ class Page(object):
# Last chance to change encoding, according to :meth:`detect_encoding`, # Last chance to change encoding, according to :meth:`detect_encoding`,
# which can be used to detect a document-level encoding declaration # which can be used to detect a document-level encoding declaration
if not self.forced_encoding:
encoding = self.detect_encoding() encoding = self.detect_encoding()
if encoding != self.encoding: if encoding and encoding != self.encoding:
self.response.encoding = encoding self.response.encoding = encoding
self.doc = self.build_doc(self.data) self.doc = self.build_doc(self.data)