Match ID string literal bytes without encoding conflicts - #740
Merged
Conversation
Collaborator
|
I have some other work in progress that will conflict with (clobber) this. But I'll either merge yours first (so it can go out in the next release) or merge mine into this PR (and give you the credit 😉). |
nevans
requested changes
Aug 29, 2026
Collaborator
There was a problem hiding this comment.
Even though I'll probably clobber your implementation with mine, I might not finish mine before the next release. Your bugfix is tiny and focused, and fixes the bug. Mine is part of a bigger refactoring of how Net::IMAP handles arguments and compiles commands.
So, can you add a small test for this, so it can go out with the next release? Thanks!
Contributor
Author
|
Added a focused regression test covering non-ASCII text through StringFormatter.string. The full command-data test file passes: 59 tests, 427 assertions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Match the literal-selection regexp against a binary view of ID strings. Matching its high-byte range directly against UTF-8 raises Encoding::CompatibilityError before ClientID can send ordinary non-ASCII names or values. Preserve the original bytes and the existing quoted-versus-literal policy.
Reproduction
Verification
rake teston this isolated branch: 1726 tests, 12594 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications, Ruby 4.0.6 via rbenv. The baseline also passes all 1,726 tests; assertion counts vary slightly across runs.git diff --checkpass. No repository tests, dependencies or workflows were added or modified; focused reproductions live outside the repository under the consumer's no-new-tests policy.6d2ef7a636a1e2449187a83b06ac7a5baa54ead2; the runtime diff from released 0.6.6 is documentation-only before this patch.Compatibility and limits
No signature or wire-format change for previously working input. Non-ASCII strings are sent as literals without transcoding. This is a formatting fix, not a change to charset negotiation or ID input validation. Other Ruby/OS versions were not run locally. No production or external IMAP service was used. Local verification does not imply upstream CI approval or comprehensive behavioral coverage.