Hi,
today I got a problem when calling ``make linkcheck`` inside of a sphinx
project. Apparently, there is a link inside the project which contains the
German Umlaut 'Ü' ('\xdc'). When reaching this URL, the linkcheck-builder raises
an Error and stops working:
.. code-block:: sh
$ make linkcheck
sphinx-build -b linkcheck -d _build/doctrees -q . _build/linkcheck
Exception in thread Thread-4:
Traceback (most recent call last):
File
"/home/waldgeist/data/homepage/sphinx/sphinx/builders/linkcheck.py", line 166,
in check
req_url.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character '\xdc' in
position 55: ordinal not in range(128)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/usr/lib/python3.4/threading.py", line 868, in run
self._target(*self._args, **self._kwargs)
File
"/home/waldgeist/data/homepage/sphinx/sphinx/builders/linkcheck.py", line 227,
in check_thread
status, info, code = check()
File
"/home/waldgeist/data/homepage/sphinx/sphinx/builders/linkcheck.py", line 168,
in check
req_url = encode_uri(req_url)
File "/home/waldgeist/data/homepage/sphinx/sphinx/util/__init__.py",
line 530, in encode_uri
split[2] = quote_plus(split[2].encode('utf-8'),
'/').decode('ascii')
AttributeError: 'str' object has no attribute 'decode'
^C
interrupted!
make: *** [linkcheck] Fehler 1
I'm using the Python3 version of Sphinx; the error occurs as well with my old
version 1.3.1 as with the current stable version 1.3.7.
In ``linkcheck.py`` there's the following part of code:
.. code-block:: python
# handle non-ASCII URIs
try:
req_url.encode('ascii')
except UnicodeError:
req_url = encode_uri(req_url)
Obviously, "UnicodeError" should be replaced with "UnicodeEncodeError" there.
But the problem still keeps the same. Only changing ``req_url.encode('ascii')``
to ``req_url.encode('utf-8')`` helps as a workaround, but then of course the
checks of all URLs containing German Umlaute fail.
Is there a better way to fix this problem?
Greetings,
Bernhard
--
You received this message because you are subscribed to the Google Groups
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.