diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2012-11-28 00:46:21 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2012-11-28 00:46:21 +0100 |
commit | 8cd10ac4efb5168f3ceb18ec94338bce73e166a7 (patch) | |
tree | 623c36d8609da02b749ffc6fe17bc025c055687f /youtube_dl/utils.py | |
parent | 64a57846d3fe3aa919ee3539956763c8ef3211b6 (diff) |
Fix printing title etc.
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 3fcb0927f..9db7b9d9d 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -61,7 +61,6 @@ try: except NameError: compat_chr = chr - std_headers = { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0', 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', @@ -83,6 +82,12 @@ def preferredencoding(): return pref +if sys.version_info < (3,0): + def compat_print(s): + print(s.encode(preferredencoding(), 'xmlcharrefreplace')) +else: + def compat_print(s): + print(s) def htmlentity_transform(matchobj): """Transforms an HTML entity to a character. |