Remove superfluous encodings

This commit is contained in:
Philipp Hagemeister 2012-11-28 00:53:09 +01:00
parent 8cd10ac4ef
commit e6137fd61d
2 changed files with 7 additions and 6 deletions

View file

@ -380,17 +380,17 @@ def process_info(self, info_dict):
# Forced printings # Forced printings
if self.params.get('forcetitle', False): 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): 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: 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: 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: 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): 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 # Do nothing else if in simulate mode
if self.params.get('simulate', False): if self.params.get('simulate', False):

View file

@ -87,6 +87,7 @@ def compat_print(s):
print(s.encode(preferredencoding(), 'xmlcharrefreplace')) print(s.encode(preferredencoding(), 'xmlcharrefreplace'))
else: else:
def compat_print(s): def compat_print(s):
assert type(s) == type(u'')
print(s) print(s)
def htmlentity_transform(matchobj): def htmlentity_transform(matchobj):