mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
1d9a3dcb5f
commit
1e163cbe10
@ -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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user