mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fixed #2102: On Windows + Py3, using `|today|` and non-ASCII date format will raise UnicodeEncodeError.
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -59,6 +59,8 @@ Bugs fixed
|
||||
transforming.
|
||||
* On Py2 environment, conf.py that is generated by sphinx-quickstart should have u prefixed
|
||||
config value for 'version' and 'release'.
|
||||
* #2102: On Windows + Py3, using ``|today|`` and non-ASCII date format will raise
|
||||
UnicodeEncodeError.
|
||||
|
||||
Release 1.3.1 (released Mar 17, 2015)
|
||||
=====================================
|
||||
|
||||
@@ -158,8 +158,15 @@ if PY2:
|
||||
# given by LC_TIME; if that is available, use it
|
||||
enc = locale.getlocale(locale.LC_TIME)[1] or 'utf-8'
|
||||
return time.strftime(text_type(format).encode(enc), *args).decode(enc)
|
||||
else:
|
||||
ustrftime = time.strftime
|
||||
else: # Py3
|
||||
def ustrftime(format, *args):
|
||||
# On Windows, time.strftime() and Unicode characters will raise UnicodeEncodeError.
|
||||
# http://bugs.python.org/issue8304
|
||||
try:
|
||||
return time.strftime(format, *args)
|
||||
except UnicodeEncodeError:
|
||||
r = time.strftime(format.encode('unicode-escape').decode(), *args)
|
||||
return r.encode().decode('unicode-escape')
|
||||
|
||||
|
||||
def safe_relpath(path, start=None):
|
||||
|
||||
Reference in New Issue
Block a user