I keep getting an error when trying to display content from an rss feed. the feeds I have tried are the Teksyndicate "kitchen sink" feed(utf-8) and the AMD news feed(encoding not set), both downloaded to my computer so I do not ping their servers evry time i run the code.
teksyndicate feed gives me 'UnicodeEncodeError: 'charmap' codec can't encode character u'\xc2' in position 183: character maps to '
amd feed gives me 'UnicodeEncodeError: 'charmap' codec can't encode character u'\u2122' in position 349: character maps to ' the code throwing the error:
import xml.etree.ElementTree as ET
xmlTree = ET.parse('amd.rss')
xmlRoot = xmlTree.getroot()
# <tag attrib>text<child/>...</tag>tail
# above pulled from Element tree lib file
for i in list(xmlTree.iter()):
if i.text != None:
print i.tag + ': ' + i.text
else:
print i.tag + ': None'
print '\n\nxmlRoot'
print xmlRoot.tag
print xmlRoot.attrib
print xmlRoot.text
print xmlRoot.tail
Just a additional note, I am trying to make an rss feed reader. I know there are ones out there, but I want to make my own just to give it a shot. That is when I ran into this error, and I have no Idea how to fix it. At this point I'm just goofing off trying to learn ElementTree.