Skip to content

Commit

Permalink
Always set encoding when reading setup.cfg
Browse files Browse the repository at this point in the history
This should fix an issue on Window where the `setup.cfg` can contain
non-ascii characters, and Python is trying to use cp1252. This should be
safe as utf-8 is compatible with cp1252.

It's possible I'll eat my words and some other platform breaks with this
change, but let's try.

Closes #294.
  • Loading branch information
fsouza committed Mar 13, 2024
1 parent b58a71a commit ae5d358
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion autoflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ def process_config_file(config_file_path: str) -> MutableMapping[str, Any] | Non
import configparser

reader = configparser.ConfigParser()
reader.read(config_file_path)
reader.read(config_file_path, encoding="utf-8")
if not reader.has_section("autoflake"):
return None

Expand Down

0 comments on commit ae5d358

Please sign in to comment.