Skip to content

Fix Frame.__str__ crashing on text fragments with partial UTF-8#1711

Open
SAY-5 wants to merge 1 commit into
python-websockets:mainfrom
SAY-5:fix-frame-str-partial-utf8
Open

Fix Frame.__str__ crashing on text fragments with partial UTF-8#1711
SAY-5 wants to merge 1 commit into
python-websockets:mainfrom
SAY-5:fix-frame-str-partial-utf8

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 12, 2026

When a text message is fragmented at a byte boundary that falls inside a multi-byte UTF-8 character, Frame.__str__ raised UnicodeDecodeError, which could tear down the connection when DEBUG logging is enabled. The OP_TEXT branch now falls back to the existing binary representation (factored into _format_binary) when the payload doesn't decode cleanly.

Closes #1695

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.

Enabling DEBUG logging breaks WebSocket connections when sending large Unicode messages

1 participant