Skip to content

test_child_process: Exercise scrubbing during transcoding - #5626

Merged
Watson1978 merged 2 commits into
masterfrom
fix-child-process-scrubbing-tests
Nov 11, 2026
Merged

Watson1978 merged 2 commits into
masterfrom
fix-child-process-scrubbing-tests

Conversation

@ashie

@ashie ashie commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Which issue(s) this PR fixes:
Fixes #4058

What this PR does / why we need it:
Ruby 3.3 and later preserve binary input when the external encoding
is ASCII-8BIT. Use EUC-JP input containing both an invalid byte and a
valid byte sequence with no Unicode mapping to exercise
invalid: :replace and undef: :replace during transcoding to UTF-8.
Verify that valid characters survive and that both default and custom
replacement characters work.

Docs Changes:
None.

Release Note:
None.

Assisted-by: GPT-6.1 Sol [Codex]

**Which issue(s) this PR fixes**:
Fixes #4058

**What this PR does / why we need it**:
Ruby 3.3 and later preserve binary input when the external encoding
is ASCII-8BIT. Use EUC-JP input with an invalid byte to exercise
scrubbing during transcoding to UTF-8. Verify that valid characters
survive and that both default and custom replacement characters work.

**Docs Changes**:
None.

**Release Note**:
None.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
Assisted-by: GPT-6.1 Sol [Codex]
@ashie
ashie requested a review from Watson1978 November 10, 2026 09:53
@Watson1978 Watson1978 added the CI Test/CI issues label Nov 10, 2026
@Watson1978 Watson1978 added this to the v1.21.0 milestone Nov 10, 2026
@Watson1978 Watson1978 added the backport to v1.19 We will backport this fix to the LTS branch label Nov 10, 2026

@Watson1978 Watson1978 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing these tests back on Ruby 3.3 and later. Using EUC-JP input to exercise scrubbing during transcoding looks good to me. One request inline: the new input no longer covers undef: :replace.

**Which issue(s) this PR fixes**:
Fixes #4058

**What this PR does / why we need it**:
Add a well-formed EUC-JP sequence with no Unicode mapping alongside
the invalid byte. Both scrubbing tests now cover the invalid and
undefined conversion options.

**Docs Changes**:
None.

**Release Note**:
None.

Assisted-by: GPT-6.1 Sol [Codex]
Signed-off-by: Takuro Ashie <ashie@clear-code.com>

@Watson1978 Watson1978 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. Both tests now cover invalid: :replace and undef: :replace. LGTM.

@Watson1978
Watson1978 merged commit d2c7287 into master Nov 11, 2026
24 checks passed
@Watson1978
Watson1978 deleted the fix-child-process-scrubbing-tests branch November 11, 2026 14:09
Watson1978 pushed a commit that referenced this pull request Nov 15, 2026
…oding (#5626) (#5637)

**Which issue(s) this PR fixes**:
Backport #5626
Fixes #4058

**What this PR does / why we need it**:
Ruby 3.3 and later preserve binary input when the external encoding
is ASCII-8BIT. Use EUC-JP input containing both an invalid byte and a
valid byte sequence with no Unicode mapping to exercise
`invalid: :replace` and `undef: :replace` during transcoding to UTF-8.
Verify that valid characters survive and that both default and custom
replacement characters work.

**Docs Changes**:
None.

**Release Note**:
None.


Assisted-by: GPT-6.1 Sol [Codex]

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Takuro Ashie <ashie@clear-code.com>
@github-actions github-actions Bot added the backported "backport to LTS" is done label Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport to v1.19 We will backport this fix to the LTS branch backported "backport to LTS" is done CI Test/CI issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Behaviour of IO#set_encoding has been changed as of Ruby 3.3

2 participants