py3: Fix strftime on python3

This commit is contained in:
Kovid Goyal 2019-04-01 14:18:11 +05:30
parent c32b7daafa
commit 45975b0c39
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -550,7 +550,9 @@ def strftime(fmt, t=None):
fmt = fmt.replace(u'%e', u'%#d')
ans = plugins['winutil'][0].strftime(fmt, t)
else:
ans = time.strftime(fmt, t).decode(preferred_encoding, 'replace')
ans = time.strftime(fmt, t)
if isinstance(ans, bytes):
ans = ans.decode(preferred_encoding, 'replace')
if early_year:
ans = ans.replace(u'_early year hack##', unicode_type(orig_year))
return ans