Repository navigation
fix(i18n): load locale JSON files saved with a UTF-8 BOM - #1658
Merged
Merged
Conversation
Owner
|
Merged via rebase after all three CI checks passed. Thank you for the focused fix and regression test! I also revalidated the exact PR head locally: 35 tests and 10,225 subtests passed, and Ruff passed. Running the actual Streamlit entry point with both ordinary UTF-8 and BOM-prefixed English/Chinese locale files rendered the generation form successfully in all four cases. Non-ASCII text and embedded U+FEFF characters were preserved. The original commit message and your author attribution have been retained. Thanks again for improving locale-file compatibility! |
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.
A locale JSON file saved with a UTF-8 BOM causes load_locales to raise JSONDecodeError while initializing translations. Read locale files with utf-8-sig so both ordinary UTF-8 and BOM-prefixed UTF-8 load successfully. Embedded U+FEFF characters and non-ASCII translations remain intact.
Validation: the BOM case failed on the original reader while plain UTF-8 passed.
python -m pytest -q test/services/test_locale_encoding.py test/services/test_webui_i18n.py: 18 passed, 10,225 subtests passed.git diff --checkpassed; Ruff passes for the new test. Ruff on the existing utility module reports 11 pre-existing style findings; no unrelated cleanup is included. No live provider calls or full media rendering were run.This is independent of the existing Docker documentation PR #1653.