From c19b9f0cf2863810765550cd19f7b7ea273a00be Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Tue, 30 Jul 2019 18:11:08 +0300 Subject: [PATCH] fix: fix encoding of xml --- genrss/__init__.py | 6 +++--- setup.py | 2 +- tests/test_rss.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/genrss/__init__.py b/genrss/__init__.py index 381e82c..7ebff80 100644 --- a/genrss/__init__.py +++ b/genrss/__init__.py @@ -239,6 +239,6 @@ class GenRSS: """ root = self.to_element() - return '\n' \ - + ('\n' if pretty else '') \ - + tostring(root, pretty_print=pretty).decode('utf-8') + return tostring(root, pretty_print=pretty, xml_declaration=True, + encoding='UTF-8').\ + decode('utf-8') diff --git a/setup.py b/setup.py index 4bad286..cec549c 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ with open('README.md', 'r') as f: if __name__ == '__main__': setup( name='genrss', - version='1.0.2', + version='1.0.3', author='Dmitriy Pleshevskiy', author_email='dmitriy@ideascup.me', description='RSS feed generator for python', diff --git a/tests/test_rss.py b/tests/test_rss.py index 1993105..d9c0eff 100644 --- a/tests/test_rss.py +++ b/tests/test_rss.py @@ -40,7 +40,7 @@ def test_feed_description(description, expose): @pytest.mark.parametrize('copyright, expose', [ - pytest.param('copyright © genrss', 'copyright © genrss', id='copy'), + pytest.param('copyright © genrss', 'copyright © genrss', id='copy'), ]) def test_feed_copyright(copyright, expose): feed = create_rss(copyright=copyright)