Help us understand the problem. What is going on with this article?

irb起動がrbreadline.rbで失敗する

More than 1 year has passed since last update.

問題

irbでEncoding.default_externalの設定変更や、日本語文字を含む正規表現などを試していたあと、irbがエラーで起動できなくなった。

C:\WINDOWS\system32>irb
C:/Ruby24-x64/lib/ruby/site_ruby/rbreadline.rb:6135:in `delete': invalid byte sequence in UTF-8 (ArgumentError)
        from C:/Ruby24-x64/lib/ruby/site_ruby/rbreadline.rb:6135:in `alloc_history_entry'
        from C:/Ruby24-x64/lib/ruby/site_ruby/rbreadline.rb:6168:in `add_history'
        from C:/Ruby24-x64/lib/ruby/site_ruby/readline.rb:368:in `<<'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:76:in `block (2 levels) in load_history'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:76:in `each'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:76:in `block in load_history'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:75:in `open'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:75:in `load_history'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:65:in `extended'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:21:in `extend'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:21:in `init_save_history'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/ext/save-history.rb:45:in `save_history='
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb/context.rb:92:in `initialize'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb.rb:412:in `new'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb.rb:412:in `initialize'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb.rb:383:in `new'
        from C:/Ruby24-x64/lib/ruby/2.4.0/irb.rb:383:in `start'
        from C:/Ruby24-x64/bin/irb.cmd:19:in `<main>'

解決

~/.irb_history から、日本語文字が含まれる行を削除したら起動できるようになった。

KoyaChan
オープンソースの入り口に立って、のれんのすきまから覗き込んでいる初老のプログラマーです。 Visual C++ とwindbg をメインに、所属会社のパッケージソフトの開発とデバッグの業務を長く続けております。業務はqiitaへの投稿記事とは関係ありません。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away