You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
context
When I execute myst-anchors to predict anchor links.
Source (saved with UTF-8):
# Title## ASCII## Ä
Built html:
<sectionid="title"><h1>Title<aclass="headerlink" href="#title" title="Permalink to this heading">¶</a></h1><sectionid="ascii"><h2>ASCII<aclass="headerlink" href="#ascii" title="Permalink to this heading">¶</a></h2></section><sectionid="a"><h2>Ä<aclass="headerlink" href="#a" title="Permalink to this heading">¶</a></h2></section></section>
expectation
Same anchors as the built HTML are shown.
$ myst-anchors source/index.mdTraceback (most recent call last): File "***\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "***\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "***\venv\Scripts\myst-anchors.exe\__main__.py", line 7, in <module> File "***\venv\lib\site-packages\myst_parser\cli.py", line 41, in print_anchors text = parser.render(args.input.read())UnicodeDecodeError: 'cp932' codec can't decode byte 0x84 in position 27: illegal multibyte sequence
problem
It seems to that myst-anchors ignores source_encoding in conf.py and uses the encoding of the locale.
Reproduce the bug
Prepare Japanese Windows environment (sorry for the difficulty ...)
sphinx-quickstart
Add myst_parser in extensions and set source_encoding in conf.py
Write index.md including non-ASCII characters
Run myst-anchors source/index.md
conf.py
source_encoding='utf_8'
List your environment
$ pythonPython 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import locale>>> locale.getdefaultlocale()('ja_JP', 'cp932')
Windows 10 Home 21H2
myst-parser==0.18.0
Sphinx==5.1.1
The text was updated successfully, but these errors were encountered:
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Describe the bug
context
When I execute myst-anchors to predict anchor links.
Source (saved with UTF-8):
Built html:
expectation
Same anchors as the built HTML are shown.
bug
But instead UnicodeDecodeError is raised.
problem
It seems to that myst-anchors ignores
source_encoding
inconf.py
and uses the encoding of the locale.Reproduce the bug
sphinx-quickstart
myst_parser
in extensions and setsource_encoding
in conf.pymyst-anchors source/index.md
conf.py
List your environment
Windows 10 Home 21H2
myst-parser==0.18.0
Sphinx==5.1.1
The text was updated successfully, but these errors were encountered: