не знаю как правильно её декодировать, при том что кодировки у страниц бывают самые разные
почему-то курл или urllib сами все декодируют, а нетворменеджеру нужны эти костыли
пока слепил вот что:
QtCore.QObject.connect(self.reply, QtCore.SIGNAL("finished()"), self.loop.quit);
self.loop.exec()
buf = self.reply.readAll()
try:
self.last_response = bytearray(buf).decode('utf8')
except UnicodeDecodeError:
try:
self.last_response = bytearray(buf).decode('cp1251')
except:
self.last_response = bytearray(buf)File "C:\Users\Администратор\Desktop\goo\engine\http.py", line 192, in _reque
t
f.write('URL' + url + "\n\n" + self.last_response)
File "C:\Python32\lib\encodings\cp1251.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\xe1' in position 9
342: character maps to
как правильно декодировать не зная кодировки?
bytearray(buf).decode('cp1251')