1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-12-24 17:35:14 +01:00

[YoutubeDL] Temporary fix for subprocess encoding issues on python2 @ Windows (Closes #4787)

For now filenames will be encoded with preferrefencoding before written to disk
This commit is contained in:
Sergey M․ 2015-01-27 22:38:28 +06:00
parent 2103d038b3
commit 3a0d2f520a

View File

@ -543,6 +543,11 @@ class YoutubeDL(object):
outtmpl = self.params.get('outtmpl', DEFAULT_OUTTMPL)
tmpl = compat_expanduser(outtmpl)
filename = tmpl % template_dict
# Temporary fix for #4787
# 'Treat' all problem characters by passing filename through preferredencoding
# to workaround encoding issues with subprocess on python2 @ Windows
if sys.version_info < (3, 0) and sys.platform == 'win32':
filename = encodeFilename(filename, True).decode(preferredencoding())
return filename
except ValueError as err:
self.report_error('Error in output template: ' + str(err) + ' (encoding: ' + repr(preferredencoding()) + ')')