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
Blog: UTF-8
encoding problems on Windows
#6917
Comments
I was able to reproduce the error but can also say that this is not generally so. I am just working on a blog tutorial and am writing about adding various things to the header of blog posts, without any problems. The content of the blog post looks fine to me, so I typed out a copy and, hey presto, it worked where the original The file is a UTF-8 file with BOM, which might be causing the problem?
It seems that Python does not read UTF-8 with BOM when the encoding UTF-8 is used? See answers to this SOF question |
@avanbremen what editor are you using on what OS? Do you have the option to save without the BOM? |
I haven't run the example, but MkDocs should handle reading UTF-8-BOM files. mkdocs-material/src/plugins/blog/structure/__init__.py Lines 59 to 75 in 2f1b2e9
Changing the |
Unless we declare this an upstream issue and ask the Python community to fix its Unicode support ;o) |
The current implementation is fixed 😆, back in Python 2 you had to add a |
@alexvoss @kamilkrzyskow thank you so much for looking into this. I am using JetBrains Rider on Windows 11. Saving I noticed that in the barebones project I included the Have a great weekend! |
Yes, because the blog plugin reads data from Markdown files itself instead of relying on MkDocs - see the code @kamilkrzyskow pointed to above. The same issue could occur on other places. I found other instances where files are read with Will tag this issue as a bug for now. As far as I can see, changing all instances of reading a file from |
Isn't Rider for C#, also weird default, never had an issue with PyCharm, which is also from JetBrain 🤔
Yes, MkDocs itself does read the files with the blog plugin's implementation is linked in the previous comment, and based on the comments it was made to provide better support for different data types in the front-matter, as otherwise everything would be a string 🤔 |
I was always asking myself what the |
UTF-8
encoding problems on Windows
I should be able to create the PRs today or tomorrow @squidfunk. This only affects file reads, for files, that could be created using another editor. So maybe not every |
Perfect, I'll assign you for now. If you run into any troubles, let us know |
Resolved via #6923 (and Insiders via https://github.com/squidfunk/mkdocs-material-insiders/pull/82) |
Released as part of 9.5.14. |
Context
No response
Bug description
When adding the built-in blog plugin and writing your first post, spinning up the live preview server will abort with a
BuildError
(init.py line 73):Including YAML style meta-data in other (not blog) Markdown files will not result in a
BuildError
.A minimal reproduction project is included.
Tested with mkdocs-material-9.4.13 and mkdocs-1.5.3.
Related links
Reproduction
material-mkdocs-blog.zip
Steps to reproduce
Browser
No response
Before submitting
The text was updated successfully, but these errors were encountered: