You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 27, 2025. It is now read-only.
Trying to run a query in italian that call a websearch the result always returns the following error:
'```python
import requests
url = "https://www.google.com/search"
params = {"q": "farmacie di turno Genova"}
response = requests.get(url, params=params)
print(response.encoding)
response.encoding = 'utf-8'
print(response.text)
Let's run the code!
</hidden>
○ (07:03 PM 13/10/2024) computer
utf-8 Traceback (most recent call last): File "", line 7, in File "C:\Program
Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.2544.0_x64__qbz5n2kfra8p0\Lib\encodings\cp1252.py", line 19, in encode return
codecs.charmap_encode(input,self.errors,encoding_table)[0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeEncodeError: 'charmap' codec can't
encode character '\u0259' in position 20975: character maps to'
The reson seems to rely to the fact that the response is alsways expected as utf-8 while sites could have their own page encoding.
Trying to run a query in italian that call a websearch the result always returns the following error:
'```python
import requests
url = "https://www.google.com/search"
params = {"q": "farmacie di turno Genova"}
response = requests.get(url, params=params)
print(response.encoding)
response.encoding = 'utf-8'
print(response.text)