質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

ただいまの
回答率

88.21%

rails c で日本語を打つと文字化けしてしまう

受付中

回答 0

投稿

  • 評価
  • クリップ 1
  • VIEW 538

shinn_sora

score 13

rails c で日本語を打つと文字化けしてしまいます。
rubyを入れ直すなどのことはqiitaの記事を見ながらやりましたが治りません。

[1] pry(main)* name = "���"
Traceback (most recent call last):
    45: from -e:1:in `<main>'
    44: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    43: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    42: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
    41: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
    40: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `block in load'
    39: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
    38: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
    37: from /Users/matsuzakishinnosuke/projects/form-practice/bin/rails:9:in `<main>'
    36: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
    35: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
    34: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
    33: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    32: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    31: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:83:in `register'
    30: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    29: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    28: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.2/lib/rails/commands.rb:18:in `<main>'
    27: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.2/lib/rails/command.rb:46:in `invoke'
    26: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.2/lib/rails/command/base.rb:65:in `perform'
    25: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    24: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    23: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    22: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.2/lib/rails/commands/console/console_command.rb:96:in `perform'
    21: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.2/lib/rails/commands/console/console_command.rb:19:in `start'
    20: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.2/lib/rails/commands/console/console_command.rb:64:in `start'
    19: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/pry_class.rb:200:in `start'
    18: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/repl.rb:13:in `start'
    17: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/repl.rb:38:in `start'
    16: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/input_lock.rb:77:in `with_ownership'
    15: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/input_lock.rb:59:in `__with_ownership'
    14: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/repl.rb:38:in `block in start'
    13: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/repl.rb:67:in `repl'
    12: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/repl.rb:67:in `loop'
    11: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/repl.rb:77:in `block in repl'
    10: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/pry_instance.rb:272:in `eval'
     9: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/pry_instance.rb:272:in `catch'
     8: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/pry_instance.rb:273:in `block in eval'
     7: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/pry_instance.rb:273:in `catch'
     6: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/pry_instance.rb:274:in `block (2 levels) in eval'
     5: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/pry_instance.rb:299:in `handle_line'
     4: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/history.rb:55:in `push'
     3: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/history.rb:55:in `call'
     2: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/history.rb:131:in `save_to_file'
     1: from /Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/history.rb:131:in `puts'
/Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/pry-0.12.2/lib/pry/history.rb:131:in `write': "\xE3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)

エラー文はこんな感じです

matsuzakishinnosukenoMacBook-puro:form-practice matsuzakishinnosuke$ find ~/.rbenv/versions -name readline.bundle
/Users/matsuzakishinnosuke/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin17/readline.bundle
/Users/matsuzakishinnosuke/.rbenv/versions/2.1.0/lib/ruby/2.1.0/x86_64-darwin17.0/readline.bundle
/Users/matsuzakishinnosuke/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-darwin17/readline.bundle
matsuzakishinnosukenoMacBook-puro:form-practice matsuzakishinnosuke$ otool -L /Users/matsuzakishinnosuke/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin17/readline.bundle
/Users/matsuzakishinnosuke/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin17/readline.bundle:
    /usr/local/opt/readline/lib/libreadline.8.dylib (compatibility version 8.0.0, current version 8.0.0)
    /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

記事にはここではreadlineが読まれていれば大丈夫と書いてありましたが日本語は文字化けしたままです。
どなたかわかる方いらっしゃいますか?

  • 気になる質問をクリップする

    クリップした質問は、後からいつでもマイページで確認できます。

    またクリップした質問に回答があった際、通知やメールを受け取ることができます。

    クリップを取り消します

  • 良い質問の評価を上げる

    以下のような質問は評価を上げましょう

    • 質問内容が明確
    • 自分も答えを知りたい
    • 質問者以外のユーザにも役立つ

    評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。

    質問の評価を上げたことを取り消します

  • 評価を下げられる数の上限に達しました

    評価を下げることができません

    • 1日5回まで評価を下げられます
    • 1日に1ユーザに対して2回まで評価を下げられます

    質問の評価を下げる

    teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。

    • プログラミングに関係のない質問
    • やってほしいことだけを記載した丸投げの質問
    • 問題・課題が含まれていない質問
    • 意図的に内容が抹消された質問
    • 過去に投稿した質問と同じ内容の質問
    • 広告と受け取られるような投稿

    評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。

    質問の評価を下げたことを取り消します

    この機能は開放されていません

    評価を下げる条件を満たしてません

    評価を下げる理由を選択してください

    詳細な説明はこちら

    上記に当てはまらず、質問内容が明確になっていない質問には「情報の追加・修正依頼」機能からコメントをしてください。

    質問の評価を下げる機能の利用条件

    この機能を利用するためには、以下の事項を行う必要があります。

まだ回答がついていません

15分調べてもわからないことは、teratailで質問しよう!

  • ただいまの回答率 88.21%
  • 質問をまとめることで、思考を整理して素早く解決
  • テンプレート機能で、簡単に質問をまとめられる

関連した質問

同じタグがついた質問を見る