mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #6964 (ebook-convert: problems with conversion in Mac OS X, If the file or folder name contains Cyrillic characters)
This commit is contained in:
parent
258812b7a5
commit
d3fa7cd6ee
@ -16,7 +16,7 @@ __builtin__.__dict__['_'] = lambda s: s
|
|||||||
# immediately translated to the environment language
|
# immediately translated to the environment language
|
||||||
__builtin__.__dict__['__'] = lambda s: s
|
__builtin__.__dict__['__'] = lambda s: s
|
||||||
|
|
||||||
from calibre.constants import iswindows, preferred_encoding, plugins
|
from calibre.constants import iswindows, preferred_encoding, plugins, isosx
|
||||||
|
|
||||||
_run_once = False
|
_run_once = False
|
||||||
winutil = winutilerror = None
|
winutil = winutilerror = None
|
||||||
@ -35,9 +35,17 @@ if not _run_once:
|
|||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Convert command line arguments to unicode
|
# Convert command line arguments to unicode
|
||||||
|
enc = preferred_encoding
|
||||||
|
if isosx:
|
||||||
|
# Newer versions of OS X seem to use UTF-8
|
||||||
|
try:
|
||||||
|
[x.decode('utf-8') for x in sys.argv[1:]]
|
||||||
|
enc = 'utf-8'
|
||||||
|
except:
|
||||||
|
pass
|
||||||
for i in range(1, len(sys.argv)):
|
for i in range(1, len(sys.argv)):
|
||||||
if not isinstance(sys.argv[i], unicode):
|
if not isinstance(sys.argv[i], unicode):
|
||||||
sys.argv[i] = sys.argv[i].decode(preferred_encoding, 'replace')
|
sys.argv[i] = sys.argv[i].decode(enc, 'replace')
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Setup resources
|
# Setup resources
|
||||||
|
Loading…
x
Reference in New Issue
Block a user