tobinus / python-podgen

Generating podcasts with Python should be easy!
https://podgen.readthedocs.org
Other
51 stars 10 forks source link

podgen fails to write (UTF-8) encoded feed to file #65

Closed ndkv closed 5 years ago

ndkv commented 6 years ago

When trying to write an UTF-8 encoded feed to file I get a

UnicodeEncodeError: 'ascii' codec can't encode character u'\xf8' in position 249: ordinal not in range(128)

generated by fd.write(rss) on line 690 in podcast.py.

A solution is to use the open function from the codecs module and specify the encoding explicitly like so

with open(filename, "w", encoding=encoding) as fd:
    fd.write(rss)

Although this fixes the problem I feel that I'm "holding podgen wrong" and am mishandling my unicode strings somewhere else... any thoughts?

ndkv commented 5 years ago

Thank you for fixing this! 🙌🏻

tobinus commented 5 years ago

No problem! Thank you for your patience ^^