Repository navigation
Conversation
RelineInputMethod called set_encoding with override: false, which still ran set_encoding on $stdin, $stdout, and $stderr. A later binary write then raised Encoding::UndefinedConversionError. override: false only records the locale encoding for IRB's own IO copies. irb -E still retargets the process streams.
This branch has not been deployed
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.
Fixes #1162.
RelineInputMethodcallsset_encodingwithoverride: false. That flag only chose which locale ivar to set; the method still ranset_encodingon$stdin,$stdout, and$stderr. Constructing the input method turned a stdout whose external encoding wasnilinto UTF-8, and a laterASCII-8BITwrite of non-ASCII bytes raisedEncoding::UndefinedConversionError. The same thing happens afterbinding.irbreturns, so code that worked before the session fails after it.override: falsenow only records the locale encoding. IRB's own copied stdout still uses that encoding, so the prompt path is unchanged.irb -E/irb -Upassoverride: trueand still retarget the process streams.Before this change, creating
RelineInputMethodmade$stdout.external_encodingUTF-8 and$stdout.write("日本語".b)raised. After it,$stdout.external_encodingstaysnil, that write succeeds, and the input method's own stdout is UTF-8. The suite is 414 tests, 2593 assertions, with no failures.