Repository navigation
Read case/hash-list JSON as utf-8-sig so a BOM doesn't break import - #3
Merged
Merged
Conversation
Some Project VIC exporters (and some hash-list tools) write the JSON as UTF-8 with a byte-order mark. Python's json rejects a leading BOM with "JSONDecodeError: Unexpected UTF-8 BOM", so importing such a file failed outright. Switch every JSON/text read on the import path from encoding="utf-8" to "utf-8-sig", which strips a leading BOM when present and is a no-op otherwise: - projectvic.load / projectvic.is_vic_file - case.parse_source_spec (GLEAPP ingest-job spec) - hashdb.import_hashset (Project VIC JSON branch and the CSV/TSV branch) Tests: _make_vic now writes its fixture with a BOM so the whole VIC suite exercises this, plus test_projectvic_json_with_bom asserting a BOM-prefixed file is detected and parsed. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VcEhYD7XkWcxocYPALdcEb
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.
Some Project VIC exporters (and some hash-list tools) write the JSON as UTF-8 with a byte-order mark. Python's json rejects a leading BOM with "JSONDecodeError: Unexpected UTF-8 BOM", so importing such a file failed outright.
Switch every JSON/text read on the import path from encoding="utf-8" to "utf-8-sig", which strips a leading BOM when present and is a no-op otherwise:
Tests: _make_vic now writes its fixture with a BOM so the whole VIC suite exercises this, plus test_projectvic_json_with_bom asserting a BOM-prefixed file is detected and parsed.
Claude-Session: https://claude.ai/code/session_01VcEhYD7XkWcxocYPALdcEb