mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-06-30 11:02:54 -05:00
utils.shell_quote: Convert the args to unicode strings
The youtube test video failed with `UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 34: ordinal not in range(128)`, the problem was with the filenames being encoded.
This commit is contained in:
@ -951,7 +951,16 @@ class locked_file(object):
|
||||
|
||||
|
||||
def shell_quote(args):
|
||||
return ' '.join(map(pipes.quote, args))
|
||||
quoted_args = []
|
||||
encoding = sys.getfilesystemencoding()
|
||||
if encoding is None:
|
||||
encoding = 'utf-8'
|
||||
for a in args:
|
||||
if isinstance(a, bytes):
|
||||
# We may get a filename encoded with 'encodeFilename'
|
||||
a = a.decode(encoding)
|
||||
quoted_args.append(pipes.quote(a))
|
||||
return u' '.join(quoted_args)
|
||||
|
||||
|
||||
def takewhile_inclusive(pred, seq):
|
||||
|
Reference in New Issue
Block a user