microsoft / microsoft/markitdown

mkdocs serve failed due to utf-8' codec can't decode byte 0x96

Open
#299 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
186k
Forks
13.7k
Avg merge
1d 4h
Merged PRs (30d)
49

Description

Convert .docx to .md file and later that file is added into mkdocs docs folder.
After:
mkdocs serve
I got the following errors:

ERROR   -  Encoding error reading file: 80566.md
ERROR   -  Error reading page '80566.md': 'utf-8' codec can't decode byte 0x96 in position 711: invalid start byte
Traceback (most recent call last):
  File "C:\Program Files\Python313\Lib\site-packages\mkdocs\livereload\__init__.py", line 211, in _build_loop
    self.builder()
    ~~~~~~~~~~~~^^
  File "C:\Program Files\Python313\Lib\site-packages\mkdocs\commands\serve.py", line 67, in builder
    build(config, serve_url=None if is_clean else serve_url, dirty=is_dirty)
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python313\Lib\site-packages\mkdocs\commands\build.py", line 310, in build
    _populate_page(file.page, config, files, dirty)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python313\Lib\site-packages\mkdocs\commands\build.py", line 159, in _populate_page
    page.read_source(config)
    ~~~~~~~~~~~~~~~~^^^^^^^^
  File "C:\Program Files\Python313\Lib\site-packages\mkdocs\structure\pages.py", line 212, in read_source
    source = self.file.content_string
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python313\Lib\site-packages\mkdocs\structure\files.py", line 462, in content_string
    return f.read()
           ~~~~~~^^
  File "<frozen codecs>", line 325, in decode
  File "C:\Program Files\Python313\Lib\encodings\utf_8_sig.py", line 69, in _buffer_decode
    return codecs.utf_8_decode(input, errors, final)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 711: invalid start byte
ERROR   -  [08:17:18] An error happened during the rebuild. The server will appear stuck until build errors are resolved.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the generated docs/80566.md file and the .docx-to-.md conversion step, then reproduce the failure with mkdocs serve. The issue is resolved when the generated Markdown is readable as UTF-8 and mkdocs serve completes without the encoding error.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.