mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 16:57:40 +00:00
Support Unicode in file names on Windows NT
This commit is contained in:
parent
661a807c65
commit
4afdff39d7
1 changed files with 8 additions and 1 deletions
|
@ -305,6 +305,13 @@ def _encodeFilename(s):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
assert type(s) == type(u'')
|
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')
|
return s.encode(sys.getfilesystemencoding(), 'ignore')
|
||||||
|
|
||||||
class DownloadError(Exception):
|
class DownloadError(Exception):
|
||||||
|
|
Loading…
Reference in a new issue