How to enter a Unicode character in a Rails console?

When using the Rails console, entering รค displays \U+FFC3\U+FFA4 . Of course, I can enter Unicode characters outside the rails.

I am using Ruby 2.0.0p247, Rails 4.0.0 on Max OS X 10.7.5.

How can I enter Unicode characters in the Rails console?

+6
source share
2 answers
+2
source

I had the same problem. After doing many things, including completely reinstalling RVM, I realized that I just needed to define LC variables. To do the same, run these commands on the 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 to save this code in .bash_profile or .bashrc files in the App folder.

+4
source

Source: https://habr.com/ru/post/957666/


All Articles