Pull requests / #1965
#1965 fix(bench): prevent UnicodeDecodeError on Windows
open · @saruiwa · 0 commentaires · Sur GitHub
Description
## Summary Fix a `UnicodeDecodeError` in `BENCH.bat` on Windows systems using non-UTF-8 default encodings, such as CP932 (Japanese Windows). ## Problem On Japanese Windows with Python 3.11, running `BENCH.bat` fails during machine information collection because `project_version()` reads `CMakeLists.txt` without specifying an encoding. Python defaults to CP932, which cannot decode the UTF-8 BOM at the beginning of the file. ```text UnicodeDecodeError: 'cp932' codec can't decode byte 0xef in position 0: illegal multibyte sequence ``` ## Fix Explicitly use `encoding="utf-8-sig"` when reading `CMakeLists.txt`. This handles UTF-8 files with or without a BOM, regardless of the system's default encoding. ## Testing - Reproduced the issue on Japanese Windows with Python 3.11. - Confirmed that setting `PYTHONUTF8=1` works around the issue. - [x] Verify that `BENCH.bat` completes without `PYTHONUTF8` after applying the fix.
Sur le site
Liens install, modèles, releases.