diff --git a/lib/irb.rb b/lib/irb.rb index 3beb1af51..528892797 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -1132,7 +1132,7 @@ def build_statement(code) return Statement::EmptyInput.new end - code.dup.force_encoding(@context.io.encoding) + code = code.dup.force_encoding(@context.io.encoding) if (command, arg = @context.parse_command(code)) command_class = Command.load_command(command) Statement::Command.new(code, command_class, arg)