diff --git a/sigal/plugins/feeds.py b/sigal/plugins/feeds.py index 149a9fa..8480e8c 100644 --- a/sigal/plugins/feeds.py +++ b/sigal/plugins/feeds.py @@ -25,7 +25,7 @@ import os from datetime import datetime from feedgenerator import Atom1Feed, Rss201rev2Feed from jinja2 import Markup -from sigal import signals +from sigal import signals, compat logger = logging.getLogger(__name__) @@ -72,7 +72,8 @@ def generate_feed(gallery, images, feed_type=None, feed_url='', nb_items=0): output_file = os.path.join(root_album.dst_path, feed_url.split('/')[-1]) logger.info('Generate %s feeds: %s', feed_type.upper(), output_file) - with codecs.open(output_file, 'w', 'utf-8') as f: + encoding = 'utf-8' if not compat.PY2 else None + with codecs.open(output_file, 'w', encoding) as f: feed.write(f, 'utf-8') diff --git a/tests/sample/pictures/dir1/test1/flickr_jerquiaga_2394751088_cc-by-nc.md b/tests/sample/pictures/dir1/test1/flickr_jerquiaga_2394751088_cc-by-nc.md new file mode 100644 index 0000000..d871335 --- /dev/null +++ b/tests/sample/pictures/dir1/test1/flickr_jerquiaga_2394751088_cc-by-nc.md @@ -0,0 +1,4 @@ +Title: WÎth spécial chÆracters + +This is a funny description of this image +