Remove superfluous encodings
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 27 Nov 2012 23:53:09 +0000 (00:53 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 27 Nov 2012 23:53:09 +0000 (00:53 +0100)
youtube_dl/FileDownloader.py
youtube_dl/utils.py

index 6ddbfc469e7bca556ec25521aa897738f892bda9..9e9f2a0e4d503f89694e0cfa830a64d8f565a524 100644 (file)
@@ -380,17 +380,17 @@ class FileDownloader(object):
 
                # Forced printings
                if self.params.get('forcetitle', False):
-                       compat_print(info_dict['title'].encode(preferredencoding(), 'xmlcharrefreplace'))
+                       compat_print(info_dict['title'])
                if self.params.get('forceurl', False):
-                       compat_print(info_dict['url'].encode(preferredencoding(), 'xmlcharrefreplace'))
+                       compat_print(info_dict['url'])
                if self.params.get('forcethumbnail', False) and 'thumbnail' in info_dict:
-                       compat_print(info_dict['thumbnail'].encode(preferredencoding(), 'xmlcharrefreplace'))
+                       compat_print(info_dict['thumbnail'])
                if self.params.get('forcedescription', False) and 'description' in info_dict:
-                       compat_print(info_dict['description'].encode(preferredencoding(), 'xmlcharrefreplace'))
+                       compat_print(info_dict['description'])
                if self.params.get('forcefilename', False) and filename is not None:
-                       compat_print(filename.encode(preferredencoding(), 'xmlcharrefreplace'))
+                       compat_print(filename)
                if self.params.get('forceformat', False):
-                       compat_print(info_dict['format'].encode(preferredencoding(), 'xmlcharrefreplace'))
+                       compat_print(info_dict['format'])
 
                # Do nothing else if in simulate mode
                if self.params.get('simulate', False):
index 9db7b9d9dcbfdd5d105ab5d6739dec2d9f52a5af..0aa350e648d154f9356d81b76a583deeb7ca4623 100644 (file)
@@ -87,6 +87,7 @@ if sys.version_info < (3,0):
                print(s.encode(preferredencoding(), 'xmlcharrefreplace'))
 else:
        def compat_print(s):
+               assert type(s) == type(u'')
                print(s)
 
 def htmlentity_transform(matchobj):