Using codecs to read the UTF-8 correctly. - zs - Zeitungsschau rss to email converter
       
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 74d725025a8b3d9409fb744fd237558387eada47
 (DIR) parent 61f5d5bbba7c474b4a7188f448cf9cbac9479485
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Sun, 25 Oct 2015 11:29:16 +0100
       
       Using codecs to read the UTF-8 correctly.
       
       Diffstat:
         zeitungsschau/feed.py               |       3 ++-
       
       1 file changed, 2 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/zeitungsschau/feed.py b/zeitungsschau/feed.py
       @@ -12,6 +12,7 @@ import dateutil.parser
        import requests
        import hashlib
        import pytz
       +import codecs
        
        def parseiso(dstr, now):
                return dateutil.parser.parse(str(dstr), default=now)
       @@ -230,7 +231,7 @@ def parse(astr):
        
        def fetch(uri):
                if "file://" in uri:
       -                fd = open(uri[7:], "r")
       +                fd = codecs.open(uri[7:], "r", "utf-8")
                        fval = fd.read().encode("utf-8")
                        fd.close()
                        rcode = 200