Issue 4212, Win problems with media path/file name with non latin.
svn: r15903
This commit is contained in:
parent
c8a48b4b0e
commit
a52072d79e
21
src/Utils.py
21
src/Utils.py
@ -37,6 +37,8 @@ import random
|
|||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
import uuid
|
import uuid
|
||||||
|
import logging
|
||||||
|
LOG = logging.getLogger(".")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -331,12 +333,23 @@ def get_unicode_path(path):
|
|||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
:returns: The Unicode version of path.
|
:returns: The Unicode version of path.
|
||||||
"""
|
"""
|
||||||
# Don't make unicode of unicode as this does not work
|
# Don't make unicode of unicode
|
||||||
# with parameter for encoding.
|
if isinstance(path, unicode):
|
||||||
if type(path) == type(u""):
|
|
||||||
return path
|
return path
|
||||||
return unicode(path, sys.getfilesystemencoding())
|
|
||||||
|
|
||||||
|
if constfunc.win():
|
||||||
|
# in windows filechooser returns officially utf-8, not filesystemencoding
|
||||||
|
try:
|
||||||
|
return unicode(path)
|
||||||
|
except:
|
||||||
|
LOG.warn("Problem encountered converting string: %s." % path)
|
||||||
|
return unicode(path, sys.getfilesystemencoding(), errors='replace')
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
return unicode(path, sys.getfilesystemencoding())
|
||||||
|
except:
|
||||||
|
LOG.warn("Problem encountered converting string: %s." % path)
|
||||||
|
return unicode(path, sys.getfilesystemencoding(), errors='replace')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user