I can't find solution for error:
UnicodeEncodeError: 'charmap' codec can't encode character '\x96' in position 582: character maps to <undefined>
which appears when I try to redirect output to file with:
python.exe page_query.py > output.html
There is no problem to display output in powershell with just:
python.exe page_query.py
but I had to use chcp 65001
command first.
Here is my short code:
import requests
payload = {'st': 'C3225X6S0J107M250AC'}
r = requests.get('http://pl.farnell.com/webapp/wcs/stores/servlet/Search?catalogId=15001&langId=-22&storeId=10170&categoryName=Wszystkie%20kategorie&selectedCategoryId=&gs=true&', params=payload)
print(r.encoding)
unicode_str = r.text
print(unicode_str)
Could you help with it?