I save the xml page locally from an API of Merriam-Webster, let me give you the url: http://www.dictionaryapi.com/api/v1/references/collegiate/xml/apple?key=bf534d02-bf4e-49bc-b43f-37f68a0bf4fd
That was an example. I urlretrieve it from the url and save it as a xml file.
Now I want to open it but a UnicodeDecodeError
occurs.
I did :
page = open('test.xml')
bs = BeautifulSoup(page)
Then the following error happens:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcb
I tried to make the url u'test.xml'
it didn't work.
sys.getdefaultencoding() 'utf-8'
The encoding configuration is already utf-8, which doesn't solve the problem, thanks for the advice anyway.