Skip to content

The degree character (°) causes a decode error #14226

@Paebbels

Description

@Paebbels

Describe the bug

When documenting code with embedded ReST in Python classes, the degree character ° like in 90° causes a decode error:

C:\Git\GitHub\pyTooling\pyTooling\doc\pyTooling\pyTooling.Cartesian2D.Shapes.rst:24: WARNING: undecodable source characters, replacing with "?": b' A rectangle is a trapezium, where opposite edges a parallel to each other and all inner angels are 90>>>\xb0<<<.\r'

class Rectangle(Trapezium[Coordinate]):
	"""
	A rectangle is a trapezium, where opposite edges a parallel to each other and all inner angels are 90°.
	"""

Source: https://github.com/pyTooling/pyTooling/blob/main/pyTooling/Cartesian2D/Shapes.py#L112

Shouldn't standard Unicode characters encoded in UTF-8 just work out of the box?

How to Reproduce

class Rectangle:
  """
  A rectangle is a trapezium, where opposite edges a parallel to each other and all inner angels are 90°.
  """

If needed, I could strip down the overall documentation to a standalone problem.

Environment Information

Sphinx version: v9.0.4

Sphinx extensions

extensions = [
  "sphinx.ext.autodoc",
  "autoapi.sphinx"
]

Additional context

As a workaround, ... 90\ |deg|\ . can be used. Therefore, isonum.txt must be included.

.. # Load pre-defined aliases and graphical characters like © from docutils
   # <file> is used to denote the special path
   # <Python>\Lib\site-packages\docutils\parsers\rst\include
.. include:: <isonum.txt>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions