mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-24 15:50:32 +01:00
Merge pull request #275 from grawity/winnt-unicode
Support Unicode in file names on Windows NT
This commit is contained in:
commit
99d46e8c27
@ -305,6 +305,13 @@ def _encodeFilename(s):
|
||||
"""
|
||||
|
||||
assert type(s) == type(u'')
|
||||
|
||||
if sys.platform == 'win32' and sys.getwindowsversion().major >= 5:
|
||||
# Pass u'' directly to use Unicode APIs on Windows 2000 and up
|
||||
# (Detecting Windows NT 4 is tricky because 'major >= 4' would
|
||||
# match Windows 9x series as well. Besides, NT 4 is obsolete.)
|
||||
return s
|
||||
else:
|
||||
return s.encode(sys.getfilesystemencoding(), 'ignore')
|
||||
|
||||
class DownloadError(Exception):
|
||||
|
Loading…
Reference in New Issue
Block a user