| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
IMAP4.search(), sort(), thread() and the uid SORT/THREAD variants now encode str search criteria to the declared charset, so international search text can be passed as ordinary str. A criterion passed as bytes is sent unchanged, for use with a charset that Python has no codec for. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documentation build overview6 files changed · ± 6 modified ± Modified |
Sorry, something went wrong.
The iconv-based codec (pythongh-152997) now resolves NF_Z_62-010 on platforms that provide iconv(3), so it no longer triggers LookupError. Use a name that neither Python nor iconv knows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts: # Doc/library/imaplib.rst # Lib/imaplib.py # Lib/test/test_imaplib.py
Document that str search criteria are encoded to the declared charset only when a charset is given; under UTF8=ACCEPT the charset is None and criteria are sent using the connection encoding. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
IMAP4.search(), sort(), thread() and the uid SORT/THREAD variants sent a CHARSET <name> token but serialized the criteria with the connection encoding (bytes(arg, self._encoding), ASCII by default), so a non-ASCII str criterion with a charset raised UnicodeEncodeError — the declared charset and the criteria byte-encoding were decoupled. This is a Python 2 legacy, from when str was 8-bit and criteria were bytes forwarded straight to the socket.
Now a str criterion is encoded to the declared charset (which must name a codec known to Python). A bytes criterion is sent unchanged, for use with a charset that Python has no codec for.
uid('SEARCH', ...) is left unchanged: its charset is unstructured (the caller passes CHARSET <name> as positional arguments), so imaplib cannot tell which argument is the charset.