Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shimizukawa opened this issue Jan 3, 2015 · 0 comments

Comments

@shimizukawa
Copy link
Member

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 "ś".


@AA-Turner AA-Turner added this to the some future version milestone Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants