crawler: clean up encoding detection code
This commit is contained in:
		@@ -261,12 +261,8 @@ class EncodingFixHandler(BaseHandler):
 | 
				
			|||||||
        if 200 <= resp.code < 300 and maintype == 'text':
 | 
					        if 200 <= resp.code < 300 and maintype == 'text':
 | 
				
			||||||
            data = resp.read()
 | 
					            data = resp.read()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if not self.encoding:
 | 
					            enc = self.encoding or detect_encoding(data, resp)
 | 
				
			||||||
                enc = detect_encoding(data, resp)
 | 
					 | 
				
			||||||
            else:
 | 
					 | 
				
			||||||
                enc = self.encoding
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if enc:
 | 
					 | 
				
			||||||
            data = data.decode(enc, 'replace')
 | 
					            data = data.decode(enc, 'replace')
 | 
				
			||||||
            data = data.encode(enc)
 | 
					            data = data.encode(enc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user