Get environment with UTF-8 encoding to prevent Windows CP1252 encoding errors. PlatformIO outputs Unicode characters (checkmarks, etc.) that fail on Windows when using the default CP1252 console encoding. This ensures UTF-8 is used.
()
| 44 | |
| 45 | |
| 46 | def _get_utf8_env() -> dict[str, str]: |
| 47 | """Get environment with UTF-8 encoding to prevent Windows CP1252 encoding errors. |
| 48 | |
| 49 | PlatformIO outputs Unicode characters (checkmarks, etc.) that fail on Windows |
| 50 | when using the default CP1252 console encoding. This ensures UTF-8 is used. |
| 51 | """ |
| 52 | env = os.environ.copy() |
| 53 | env["PYTHONIOENCODING"] = "utf-8:replace" |
| 54 | env["PYTHONUTF8"] = "1" |
| 55 | return env |
| 56 | |
| 57 | |
| 58 | @dataclass |
no test coverage detected