FIX Unicode madness

In Python3.6 you need to encode to utf-8 and write as bytes  3.7 appears to have just worked?
1 files changed, 4 insertions(+), 7 deletions(-)

M feed2maildir/converter.py
M feed2maildir/converter.py +4 -7
@@ 144,6 144,7 @@ Content-Type: text/plain
                             new[feedname] = [post, ]
 
             newtimes[feedname] = feedup.strftime('%Y-%m-%d %H:%M:%S %Z')
+            self.output('Feedname : {} : Feedup : {}'.format(feedname, newtimes[feedname]))
 
         return (new, newtimes)
 

          
@@ 202,16 203,12 @@ Content-Type: text/plain
         host = os.uname()[1]
         name = u'{}/new/{}{}{}{}'.format(self.maildir, rand, dt, pid, host)
         try: # to write out the message
-            with open(name, 'w') as f:
-                # We can thank the P2/P3 unicode madness for this...
-                if sys.version[0] == '2':
-                    f.write(str(message.encode('utf8')))
-                else:
-                    f.write(message)
+            with open(name, 'wb') as f:
+                f.write(message.encode('utf-8'))
         except:
             os.remove(name)
+            self.output('WARNING: failed to write message to file: {}'.format(name))
             raise
-            self.output('WARNING: failed to write message to file')
 
     def mktime(self, arg):
         """Make a datetime object from a time string"""