-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow overriding the Reline encoding #755
Comments
The crash is fixed in #751
When Encoding.default_external is set to ascii-8bit, Reline thinks terminal emulator's encoding is ascii-8bit. Any bytes (not restricted to utf-8) could come to STDIN and all Reline should encode output to ascii-8bit before printing them to STDOUT, but If your request is to have an ascii-8bit mode like this, please open another issue.
|
Hello! Thanks for getting back to us. For context, for our project we set the default_encoding to be ASCII-8BIT as we deal with a lot of binary data blobs by default - and rarely UTF-8. However we want to configure Reline separately to use UTF-8. For our scenario it would be great if Reline would either use the IO object's encoding or would allow for separate configuration to UTF-8, maybe something like:
Hopefully the above context clarifies why we can't globally change |
Thank you for the detailed scenario
The idea using IO object's encoding looks good. |
Description
Currently the Reline library uses the Ruby's default encoding, but this is not configurable:
reline/lib/reline/io/ansi.rb
Lines 43 to 45 in 7534f7f
It would be great to configure this value, i.e. in the scenario of having the encoding set to ASCII-8BIT globally - but wanting Reline to use UTF-8 encoding:
Example
Pasting in the characters
こんにちは
Current Behaviour
Crash:
gems/reline-0.5.10/lib/reline/unicode.rb:112:in 'encode': "\\xE3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
Desired Behaviour
Being able to configure the value on Reline:
Terminal Emulator
OSX
Version
0.5.10
The text was updated successfully, but these errors were encountered: