I made a script to download a few pages from a server using BeautifulSoup. I am writing the output to a .csv file. I am using python 2.7.2
I get the following error at some point:
Traceback (most recent call last):
File "parser.py", line 114, in <module>
c.writerow([title,description,price,weight,category,subcategory])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 61: ordinal not in range(128)
The page I am downloading from (I checked the exact page) doesn't seem to have any weird characters.
I tried some of the solutions from the similar questions. I tried decoding like this:
content.decode('utf-8','ignore')
but it did not work.
As pointed out in Python and BeautifulSoup encoding issues . I checked the website source and it doesn't have any specified meta data either. I also tried using the ''chardet'' as suggested in How to download any(!) webpage with correct charset in python? however the urlread() method doesn't seem to work. I tried with urlopen() instead and it crashed.
How can I proceed with this?