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 Ruby 2.0.0p247, Rails 4.0.0 in Max OS X 10.7.5.
How can I input Unicode characters in Rails console?
Inserting Unicode characters To insert a Unicode character, type the character code, press ALT, and then press X. For example, to type a dollar symbol ($), type 0024, press ALT, and then press X. For more Unicode character codes, see Unicode character code charts by script.
Unicode is a universal character encoding standard. This standard includes roughly 100000 characters to represent characters of different languages. While ASCII uses only 1 byte the Unicode uses 4 bytes to represent characters. Hence, it provides a very wide variety of encoding.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With