diff --git a/mypy/build.py b/mypy/build.py index f3df5f18f54d..e636b606ed8f 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -511,7 +511,7 @@ def find_config_file_line_number(path: str, section: str, setting_name: str) -> in_desired_section = False try: results = [] - with open(path) as f: + with open(path, encoding="UTF-8") as f: for i, line in enumerate(f): line = line.strip() if line.startswith('[') and line.endswith(']'): diff --git a/test-data/unit/cmdline.pyproject.test b/test-data/unit/cmdline.pyproject.test index ea561ed164e7..831bce2eb63d 100644 --- a/test-data/unit/cmdline.pyproject.test +++ b/test-data/unit/cmdline.pyproject.test @@ -125,3 +125,11 @@ i: int = 0 This isn't even syntatically valid! [file x/please_skipme_.py] Neither is this! + +[case testPyprojectTOMLUnicode] +# cmd: mypy x.py +[file pyproject.toml] +\[project] +description = "Factory ⸻ A code generator 🏭" +\[tool.mypy] +[file x.py]