I get information from the page, but it is encoded with an encoding that doesn’t suit me:
response = session.post(
url=uri,
headers={
'Accept-Charset': 'utf-8'
}
)
error_message = re.search(r'b-content__red\"\>(.+?)\<', response.text)
Text:
Обратитесь в службу поддержки вашего банка.
Then i'm trying to convert it:
import cchardet
if error_message:
error_message = error_message.group(1).encode()
encoding = cchardet.detect(error_message)['encoding']
if 'UTF-8' != encoding.upper():
error_message = error_message.decode('utf-8')
But the result is still the same. What am I doing wrong?