How to input Unicode character in Rails console?

前端 未结 2 1586
悲&欢浪女
悲&欢浪女 2021-01-04 10:42

While using Rails console, when I input ä, \\U+FFC3\\U+FFA4 appears. Of course I can input Unicode characters outside of rails.

I\'m using

相关标签:
2条回答
  • 2021-01-04 11:19

    I did have the same problem. After done a lot of things, including the complete reinstall of RVM, I'd realized I just need to define the LC variables. To do the same, run these commands on terminal:

    LANG="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_CTYPE="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_ALL="en_US.UTF-8"
    export LANG LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LC_ALL
    

    One good idea is save this code in .bash_profile or .bashrc files in the App folder.

    0 讨论(0)
  • 2021-01-04 11:39

    Most likely you've got readline issue, try to re-install Ruby with readline support. https://github.com/wayneeseguin/rvm/issues/1016 or http://blog.rlmflores.me/blog/2012/04/25/adding-utf-8-support-to-rubies-compiled-through-ruby-build/

    0 讨论(0)
提交回复
热议问题