fix wrong encoding detection logic
This commit is contained in:
parent
f0aed18233
commit
137590e819
1 changed files with 5 additions and 4 deletions
|
|
@ -137,10 +137,11 @@ class Page(object):
|
|||
|
||||
# Last chance to change encoding, according to :meth:`detect_encoding`,
|
||||
# which can be used to detect a document-level encoding declaration
|
||||
encoding = self.detect_encoding()
|
||||
if encoding != self.encoding:
|
||||
self.response.encoding = encoding
|
||||
self.doc = self.build_doc(self.data)
|
||||
if not self.forced_encoding:
|
||||
encoding = self.detect_encoding()
|
||||
if encoding and encoding != self.encoding:
|
||||
self.response.encoding = encoding
|
||||
self.doc = self.build_doc(self.data)
|
||||
|
||||
# Encoding issues are delegated to Response instance, implemented by
|
||||
# requests module.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue