Fix crash when using %e with strftime on windows

Fixes #1206705 [strftime crashes under Windows with %e](https://bugs.launchpad.net/calibre/+bug/1206705)
This commit is contained in:
Kovid Goyal 2013-07-31 09:37:26 +05:30
parent 1d9a3dcb5f
commit 1e163cbe10

View File

@ -509,6 +509,7 @@ def strftime(fmt, t=None):
if iswindows:
if isinstance(fmt, unicode):
fmt = fmt.encode('mbcs')
fmt = fmt.replace(b'%e', b'%#d')
ans = plugins['winutil'][0].strftime(fmt, t)
else:
ans = time.strftime(fmt, t).decode(preferred_encoding, 'replace')