projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
661a807
)
Support Unicode in file names on Windows NT
author
Mantas Mikulėnas
<grawity@nullroute.eu.org>
Mon, 16 Jan 2012 10:05:59 +0000
(12:05 +0200)
committer
Mantas Mikulėnas
<grawity@nullroute.eu.org>
Mon, 16 Jan 2012 10:08:01 +0000
(12:08 +0200)
youtube_dl/__init__.py
patch
|
blob
|
history
diff --git
a/youtube_dl/__init__.py
b/youtube_dl/__init__.py
index be599a2b29953b9b8c7bf6204ed5c0bee9df5733..52da3b859287cb3f1fd8fb8eedb6015019be8da4 100755
(executable)
--- a/
youtube_dl/__init__.py
+++ b/
youtube_dl/__init__.py
@@
-305,7
+305,14
@@
def _encodeFilename(s):
"""
assert type(s) == type(u'')
"""
assert type(s) == type(u'')
- return s.encode(sys.getfilesystemencoding(), 'ignore')
+
+ 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):
"""Download Error exception.
class DownloadError(Exception):
"""Download Error exception.