I am trying to grab an article from the web and write it to the database.
If I do this
article = article.decode('utf-8')
I get this:
'ascii' codec can't decode byte 0xc3 in position 25729: ordinal not in range(128)
If I do this
article = article.encode('utf-8')
I get this:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 5409: ordinal not in range(128)
If I do this
article = article.encode('utf-8').decode()
or this
article = article.decode().encode('utf-8')
I still get this
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 5409: ordinal not in range(128)
Questions:
Any help will be greatly appreciated on solving this problem!
EDIT: Stackoverflow recommended an article that said do .encode('utf-8') as per the above, this doesn't work, the error persists.