Incorrect encoding of doc strings of properties inherited from class defined in different module containing correct encoding declaration

Arfrever Frehtes Taifersar Arahesis avatarArfrever Frehtes Taifersar Arahesis created an issue

Sphinx uses incorrect encoding of doc strings of properties inherited from class defined in different module containing correct encoding declaration.

This issue is similar to issue #1185. Before commit 56e385ec3f5b, there was an exception, now Sphinx uses incorrect encoding.

Example (reproducible with Python 2):

$ cat docs/conf.py
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))

extensions = ["sphinx.ext.autodoc"]
master_doc = "index"
$ cat docs/index.rst
documentation
=============

.. autoclass:: module1.Class1
    :inherited-members:

.. autoclass:: module2.Class2
    :inherited-members:
$ cat module1.py
# -*- coding: utf-8 -*-

class Class1:
    def get_myproperty(self):
        """doc string of get_myproperty. ś"""
        return 0

    def set_myproperty(self, value):
        """doc string of set_myproperty. ś"""
        pass

    myproperty = property(get_myproperty, set_myproperty, doc="doc string of myproperty. ś")
$ cat module2.py
import module1

class Class2(module1.Class1):
    pass

module1.py contains utf-8 encoding declaration and defines doc strings with "ś" character. module2.py defines a class, which inherits from class defined in module1.py.

index.html generated by Sphinx running under Python 2 contains:

class module1.Class1
    get_myproperty()
        doc string of get_myproperty. ś
    myproperty None
        doc string of myproperty. ś
    set_myproperty(value)
        doc string of set_myproperty. ś

class module2.Class2
    get_myproperty()
        doc string of get_myproperty. ś
    myproperty None
        doc string of myproperty. ś
    set_myproperty(value)
        doc string of set_myproperty. ś

The documentation of module2.Class2.myproperty contains "ś" character instead of "ś".

Comments (0)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.