close
Skip to content

Fix RichHandler surrogate logging on strict utf-8 streams#4095

Open
lwhelton wants to merge 1 commit intoTextualize:masterfrom
lwhelton:fix-richhandler-unicode-3600
Open

Fix RichHandler surrogate logging on strict utf-8 streams#4095
lwhelton wants to merge 1 commit intoTextualize:masterfrom
lwhelton:fix-richhandler-unicode-3600

Conversation

@lwhelton
Copy link
Copy Markdown

Type of changes

  • [ X] Bug fix
  • New feature
  • Documentation / docstrings
  • [] Tests
  • Other

AI?

  • AI was used to generate this PR

AI generated PRs may be accepted, but only if @willmcgugan has responded on an issue or discussion.

Checklist

  • [X ] I've run the latest black with default args on new code.
  • [X ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate (see note about typos above).
  • [ X] I've added tests for new code.
  • [ X] I accept that @willmcgugan may be pedantic in the code review.

Description

Fixes a UnicodeEncodeError in RichHandler when logging messages contain surrogate characters and the target stream uses strict UTF-8 encoding. The handler now escapes unencodable messages before constructing the final Rich text object, which preserves logging output instead of crashing. A regression test was added to cover strict UTF-8 stream behavior.
Important: Link to an issue or discussion regarding these changes.

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.

1 participant