Support for the Ruby 2.4 series has ended. See here for reference.
Use a File for IO with irb, see InputMethod
The external encoding for standard input.
# File irb/input-method.rb, line 124
def encoding
@io.external_encoding
end