lkiesow / python-feedgen

Python module to generate ATOM feeds, RSS feeds and Podcasts.
https://feedgen.kiesow.be/
BSD 2-Clause "Simplified" License
723 stars 123 forks source link

atom_str and rss_str return bytestrings when their docstrings indicate they return strings (Python3) #45

Closed ned2 closed 8 years ago

ned2 commented 8 years ago

Under Python 3 atom_str and rss_str in feed.py both return a bytestring when their docstrings indicate they return strings. This seems to be because xml.etree.ElementTree.tostring returns a bytestring unless the encoding='unicode' argument is supplied. I did try passing in this parameter but it doesn't seem like lxml likes this: ValueError: Serialisation to unicode must not request an XML declaration

lkiesow commented 8 years ago

You can get Unicode back like this:

fg.atom_str(xml_declaration=False, encoding='Unicode')

I've added a note about this to the method's documentation.