Repository navigation
bink_names: read a streams JSON index saved with a UTF-8 BOM - #5877
Open
evilclanker9000 wants to merge 2 commits into
Open
evilclanker9000 wants to merge 2 commits into
evilclanker9000 wants to merge 2 commits into
Conversation
load_streams() opened the .json index with encoding=utf-8, so an index written by PowerShell 5.1 (which writes a BOM) ended in a JSONDecodeError. Use utf-8-sig, as world_build.py and world_names.py already do.
Fails on the previous commit with JSONDecodeError: Unexpected UTF-8 BOM; passes with utf-8-sig.
Contributor
|
Tested 324856a merged with main 561b65a on Ubuntu (WSL2) / Python 3.12.16: pass tests/test_bink_names.py: 34 run, 34 passed, 0 failed. Negative control: with tools/bink_names.py checked out from upstream/main, the new test_json_source_saved_with_a_utf8_bom_is_read errors (JSONDecodeError: Unexpected UTF-8 BOM), 34 run, 1 error. Diff is a one-line encoding change (utf-8 to utf-8-sig) plus the test; no other readers affected. |
1 task done
|
Tested
Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tools/bink_names.pyload_streams()opened a streams.jsonindex withencoding="utf-8". Windows PowerShell 5.1 (Set-Content,Out-File) writes text files with a UTF-8 BOM, so an index a user saved that way ended injson.decoder.JSONDecodeError: Unexpected UTF-8 BOMand the tool exited with an error instead of naming the streams. Read the JSON branch withutf-8-sig, the same wayworld_build.pyandworld_names.pyalready read their input. The CSV branch is unchanged.EGEN-BINK-NAMES-BOM.
Test
Before (tool unchanged):
FAILED (errors=1)—json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0).After:
Ran 1 test in 0.016s / OK.Full file:
python -I tests/test_bink_names.py→Ran 34 tests, one failure that is already onupstream/main561b65a8without this change (test_unreadable_mount_directory_preserves_the_reportexpects the plain path, the OSError message repr's it — the subject of open #5760), and 33/34 otherwise. No GPU needed.Notes
AI-assisted.