Repository navigation
Decode extended MIME parameters when reading PO catalogs - #1536
Open
echo666939 wants to merge 1 commit into
Open
echo666939 wants to merge 1 commit into
echo666939 wants to merge 1 commit into
Conversation
Decode RFC 2231 values returned by the email parser before consuming the catalog charset and plural forms. Leave ordinary string parameters untouched. Fixes python-babel#1533
This branch has not been deployed
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.
Fixes #1533.
The email parser returns a tuple for extended MIME parameters. Decode those values with
email.utils.collapse_rfc2231_valueat the header parsing boundary so charset and plural-form handling both receive strings. Ordinary parameter values keep their existing parsing behavior.The regression reads a byte-stream PO catalog with an ISO-8859-1 translation and extended plural parameters. It failed with
AttributeErrorbefore the change and passes afterward. On Windows with Python 3.11, all 129 tests intest_pofile.pyandtest_catalog.pypassed. The fulltests/messagesrun had 527 passes and one failure in the setuptools command smoke test (init_catalogis not registered in this uninstalled checkout).OpenAI Codex assisted with the code, regression test, validation, and PR text.