Repository navigation
Conversation
Python 3.16 adds the utf_7_imap codec (the modified UTF-7 of IMAP mailbox names). Its decoder raises UnicodeError for any error handler other than "strict", and detection decodes candidates with errors="ignore", so detecting a single-byte encoding could fail. Leave it out of IANA_SUPPORTED, like rot_13, tactis and mbcs. Fixes jawah#824
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 #824
Python 3.16 adds the
utf_7_imapcodec (python/cpython@562606d), the modified UTF-7 of IMAP mailbox names. It shows up inencodings.aliases, so it lands inIANA_SUPPORTED. Its decoder raisesUnicodeError: Unsupported error handling: ignorefor any handler other than"strict", and detection builds decoders witherrors="ignore"(encoding_unicode_range(),cp_similarity()). On 3.16 that broke detection for samples such as cp1252, cp1253 and mac_cyrillic.It isn't an encoding for documents, so this leaves it out of
IANA_SUPPORTED, likerot_13,tactisandmbcs. The new test checks that every supported encoding acceptserrors="ignore", so the next codec like this fails a test instead of detection.Tested on Python 3.16.0a1 (
python:3.16.0a1-slim):utf_7_imapOn Python ≤ 3.15 the codec doesn't exist, so nothing changes there.