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. Note: This function inherits Git Bash environment var
()
| 7 | |
| 8 | |
| 9 | def get_utf8_env() -> dict[str, str]: |
| 10 | """Get environment with UTF-8 encoding to prevent Windows CP1252 encoding errors. |
| 11 | |
| 12 | PlatformIO outputs Unicode characters (checkmarks, etc.) that fail on Windows |
| 13 | when using the default CP1252 console encoding. This ensures UTF-8 is used. |
| 14 | |
| 15 | Note: This function inherits Git Bash environment variables. For PlatformIO |
| 16 | operations that must run via CMD (e.g., ESP32-C6 compilation), use |
| 17 | get_pio_execution_env() instead. |
| 18 | """ |
| 19 | env = os.environ.copy() |
| 20 | env["PYTHONIOENCODING"] = "utf-8:replace" |
| 21 | env["PYTHONUTF8"] = "1" |
| 22 | return env |
| 23 | |
| 24 | |
| 25 | def get_pio_execution_env() -> dict[str, str]: |
no test coverage detected