I can't fix the accents

Question:

I am having problems with a code created in python, and it is that when I generate some texts in json the accents are not appreciated

This is my code that I am using…

import requests

url =  requests.get(f"https://images.habbo.com/habbo-web-news/es/production/front.json")
resumen =  url.json()[0]['summary']

print(resumen)

I get these weird characters "& # x E D;"

Asked By: aroaMinecraft

||

Answers:

Hope this helps:

import html
import requests

url = requests.get(
    f"https://images.habbo.com/habbo-web-news/es/production/front.json")

content = url.json()

summary = content[0]["summary"]

decoded = html.unescape(summary)

print (decoded)
Answered By: PCDSandwichMan

Maybe it has to do with the encoding, please refer to the request documentation in the response content section. The "content" key on the json files have a strange format to be spanish, tho.

Answered By: paaoogh
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.