Home>

I get a page, it is in ISO-8859-1

Import Requests
url= 'https://www.fonbet.com/live/?locale=ru'
R= Requests.get (URL)
Print (R.Text)
# Print (R.Text.Encode ('UTF-8'))

In Print () I see:

<
! -94 ->
≪
HTML >
    ≪
HEAD >
        ≪
Title >
ÐÐμÑкР° Ð »Ð¾ ФонР± ÐμÑ â www.fonbet52.com â л иР± о +1 иР»Ð¸ +2 -Ð'оÑÑÑп к ÑÐ ° йÑÑ Ð ± ÑкмÐμкÐμÑÐ ° <
/title >

Tell me, please, how to decode in readable text?

  • Answer # 1

    If the site in the HTTP header gives the wrong encoding, you can solve this:

    R= Requests.get (URL)
    R.ENCoding= 'UTF-8' # specify the correct encoding forcibly
    Print (R.Text)
    

    either, you can contact the field R.content The answer is stored in the form of bytes that can be decoded with the correct encoding:

    Print (R.Content.Decode ('UTF-8'))