Skip to content

gh-159739: Preserve non-BMP characters in multibyte encoders - #159987

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-multibyte-pair-nonbmp
Oct 21, 2026
Merged

JelleZijlstra merged 1 commit into
python:mainfrom
jelle-openai:jelle/codex/gh-159739-multibyte-pair-nonbmp

Conversation

@jelle-openai

@jelle-openai jelle-openai commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Preserve non-BMP characters in multibyte encoders. Some Big5-HKSCS and JIS X 0213 encoders look up a two-character mapping after narrowing or masking the second code point to 16 bits. A non-BMP character whose low bits match a valid combining character can be silently consumed as that character, changing the text on encode/decode instead of raising UnicodeEncodeError with the default error handler.

Backport to 3.15 and 3.14.

@JelleZijlstra JelleZijlstra added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 20, 2026
@JelleZijlstra
JelleZijlstra enabled auto-merge (squash) October 21, 2026 18:46
@JelleZijlstra
JelleZijlstra merged commit 600f99d into python:main Oct 21, 2026
63 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @jelle-openai for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

GH-160094 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 21, 2026
@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

GH-160095 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 21, 2026
JelleZijlstra pushed a commit that referenced this pull request Oct 22, 2026
…H-159987) (#160094)

(cherry picked from commit 600f99d)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants