Skip to content

Handle SyntaxError#message with invalid encoding#1115

Closed
alpaca-tc wants to merge 1 commit into
ruby:masterfrom
alpaca-tc:fix-syntax-error
Closed

Handle SyntaxError#message with invalid encoding#1115
alpaca-tc wants to merge 1 commit into
ruby:masterfrom
alpaca-tc:fix-syntax-error

Conversation

@alpaca-tc

Copy link
Copy Markdown
Contributor

related: https://bugs.ruby-lang.org/issues/21528

This patch fixes an issue in IRB where it fails to handle a SyntaxError#message that has invalid encoding.

The root cause is that prism may generate a SyntaxError#message with broken encoding when the source contains multibyte characters. This patch ensures irb can handle such cases gracefully.

However, if this is considered a bug in Ruby itself, this pull request does not need to be merged.

related: https://bugs.ruby-lang.org/issues/21528

This patch fixes an issue in IRB where it fails to handle a `SyntaxError#message` that has invalid encoding.

The root cause is that prism may generate a `SyntaxError#message` with broken encoding when the source contains multibyte characters. This patch ensures irb can handle such cases gracefully.
@alpaca-tc

Copy link
Copy Markdown
Contributor Author

@alpaca-tc alpaca-tc closed this Sep 15, 2025
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