M
M
Magic Code2020-08-24 18:41:22
Python
Magic Code, 2020-08-24 18:41:22

How to convert text from ASCII to UTF-8?

Good evening!

Guys, I try to recode to UTF-8, nothing comes out.
Here is the code:

page = 1
searching = 'ruby'
url = f'https://search.buzz.im/api/v1/search/messages_simple?query_text=' \
        f'{searching}&query_size=100&query_from={page}'
r = requests.get(url)
print(r.text.encode().decode("utf-8", "ignore"))

Only a small part can be decoded. Tell me how to do it better?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-08-24
@Panda_Code

Nothing needs to be decoded here, you need to use it. r.json()But the response is truncated json, which is why the error occurs. With query_size=10 everything is ok.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question