ruff/scripts
Auguste Lalande 4c05c258de
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.
2024-03-06 05:57:27 +00:00
..
benchmarks Bump version to v0.3.0 (#10151) 2024-02-29 16:05:20 +01:00
_utils.py Use __future__ imports in scripts (#5301) 2023-06-22 11:40:16 -04:00
add_plugin.py Rename ruff crate to ruff_linter (#7529) 2023-09-20 08:38:27 +02:00
add_rule.py Rename RuleGroup::Unspecified to Stable (#7991) 2023-10-16 14:53:27 -05:00
check_docs_formatted.py [pycodestyle] Add blank line(s) rules (E301, E302, E303, E304, E305, E306) (#9266) 2024-02-08 18:35:08 +00:00
check_ecosystem.py Add a non-latin project to the ecosystem checks (#9199) 2023-12-19 16:14:01 -05:00
Dockerfile.ecosystem Remove outdated feature flag from Dockerfile.ecosystem (#4620) 2023-05-24 08:19:08 +00:00
ecosystem_all_check.py Rename Autofix to Fix (#7657) 2023-09-28 10:53:05 +00:00
ecosystem_all_check.sh Rename Autofix to Fix (#7657) 2023-09-28 10:53:05 +00:00
ecosystem_all_check_entrypoint.sh Make ecosystem all check more generic (#4629) 2023-05-24 16:26:23 +02:00
formatter_ecosystem_checks.sh Fix the ecosystem check (#10155) 2024-02-28 17:42:06 +00:00
generate_known_standard_library.py Remove HashMap and HashSet for known-standard-library detection (#5345) 2023-06-23 19:59:03 +00:00
generate_mkdocs.py Add encoding when opening files in generate_mkdocs.py (#10244) 2024-03-06 05:57:27 +00:00
pyproject.toml Use tool.ruff.lint in more places (#8317) 2023-10-28 18:39:38 -05:00
transform_readme.py Use __future__ imports in scripts (#5301) 2023-06-22 11:40:16 -04:00
update_ambiguous_characters.py Use characters instead of u32 in confusable map (#8463) 2023-11-03 09:57:47 -04:00
update_schemastore.py Fix the sorting of the schema submited to schemastore (#10173) 2024-02-29 18:21:54 +00:00