sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.45k stars 2.1k forks source link

Inconsistent smart quotes for zh_CN and zh_TW #12874

Closed khanxmetu closed 1 day ago

khanxmetu commented 2 weeks ago

Describe the bug

docutils is unable to differentiate between opening and closing quotes in Chinese text, as words in Chinese are written without spaces too.

How to Reproduce

index.rst

我喜歡"書"和"音樂"。

conf.py

language="zh_TW"

Build:

sphinx-build . build

./build/index.html contains:

我喜歡」書」和」音樂」。

Expected Output:

我喜歡「書」和「音樂」。

Similar procedure for language=zh_CN

Environment Information

Platform:              linux; (Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.39)
Python version:        3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0])
Python implementation: CPython
Sphinx version:        8.0.2
Docutils version:      0.21.2
Jinja2 version:        3.1.4
Pygments version:      2.18.0

Sphinx extensions

No response

Additional context

Relates to issue #4142.

Solution

Disable default smartquotes behavior for zh_CN and zh_TW languages too.