Closed
Description
Description
Currently the Reline library uses the Ruby's default encoding, but this is not configurable:
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:
::Encoding.default_external = ::Encoding::ASCII_8BIT
::Encoding.default_internal = ::Encoding::ASCII_8BIT
# Workaround to fix encoding crash:
# class ::Reline::ANSI
# def encoding
# ::Encoding::UTF_8
# end
# end
ascii_text = Reline.readline('prompt > ', false)
$stderr.puts ascii_text.encoding.to_s
Example
Pasting in the characters こんにちは
prompt > こんにちは
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:
def encoding
@encoding || Encoding.default_external
end
Terminal Emulator
OSX
Version
0.5.10