Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add encoding when opening files in generate_mkdocs.py (#10244)
## Summary Open files with utf8 encoding when writing files in generate_mkdocs.py. The following can happen otherwise. ``` ../ruff> python scripts/generate_mkdocs.py Finished dev [unoptimized + debuginfo] target(s) in 0.25s Running `target\debug\ruff_dev.exe generate-docs` Traceback (most recent call last): File "C:\..\ruff\scripts\generate_mkdocs.py", line 185, in <module> main() File "C:\..\scripts\generate_mkdocs.py", line 141, in main f.write(clean_file_content(file_content, title)) File "C:\..\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 1396-1397: character maps to <undefined> ``` I could not determine which character was causing the issue, but opening with utf8 encoding fixed it. ## Test Plan Condering the change is small, I simply ran the file and confirmed it worked, but opened to suggestion on more robust testing.
- Loading branch information