# Script/console UTF-8 MacOS X?

**URL:** <https://www.ruby-forum.com/t/script-console-utf-8-macos-x/137118>\
**Category:** Rails\
**Created:** [May 9, 2008, 2:32am UTC](https://www.ruby-forum.com/t/script-console-utf-8-macos-x/137118 "2008-05-09T02:32:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stedwick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@stedwick](https://www.ruby-forum.com/u/stedwick)\
**Post date:** [May 9, 2008, 2:32am UTC](https://www.ruby-forum.com/t/script-console-utf-8-macos-x/137118/1 "2008-05-09T02:32:26Z")

</div>

Is it possible to use foreign characters with UTF-8 encoding in the  
console on MacOS X? I found a few OLD tutorials on the Internet and  
none of them seemed to work. I’m using Leopard by the way. When I try  
to paste in Chinese characters from AltaVista Babel Fish it just  
starts beeping and nothing happens.

---

<div class="post-metadata">

**Author:** ![stedwick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@stedwick](https://www.ruby-forum.com/u/stedwick)\
**Post date:** [May 9, 2008, 5:27pm UTC](https://www.ruby-forum.com/t/script-console-utf-8-macos-x/137118/2 "2008-05-09T17:27:57Z")

</div>

On 5/9/08, Stedwick [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is it possible to use foreign characters with UTF-8 encoding in the  
> console on MacOS X? I found a few OLD tutorials on the Internet and  
> none of them seemed to work. I’m using Leopard by the way. When I try  
> to paste in Chinese characters from AltaVista Babel Fish it just  
> starts beeping and nothing happens.

How is your question related to Ruby on Rails? What’s foreign  
caracters? English is very foreign to me. Also, please specify your  
current settings of Terminal and what exactly you tried to paste.

---

<div class="post-metadata">

**Author:** ![stedwick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@stedwick](https://www.ruby-forum.com/u/stedwick)\
**Post date:** [May 12, 2008, 12:07am UTC](https://www.ruby-forum.com/t/script-console-utf-8-macos-x/137118/3 "2008-05-12T00:07:50Z")

</div>

I’m using the Ruby on rails plug-in called globalize. It works great  
so far through the browser, but I would like to be able to mess with  
it using the script/console command.

I went to AltaVista Babel Fish and translated some English text into  
simplified Chinese. When I paste that into the MacOS X terminal it  
works fine, but only in the bash shell not in the script/console. When  
I try to paste simplified Chinese characters into the script/console  
it just beeps and does nothing.

Chinese characters work fine when submitted using a form in a browser  
(again translated with Babel Fish), so I know that globalize is  
working, but I would like to be able to mess with it using the script/  
console.

The $KCODE is set to UTF-8 and the MacOS X terminal preferences are  
set to UTF-8 and the “escape non-ASCII characters” checkbox is NOT  
checked. Again, pasting Chinese into the terminal works fine, it just  
doesn’t work when script/console is running.

It’s not the end of the world of course, but I would appreciate any  
ideas that you have 🙂

---

<div class="post-metadata">

**Author:** ![stedwick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@stedwick](https://www.ruby-forum.com/u/stedwick)\
**Post date:** [May 12, 2008, 8:06pm UTC](https://www.ruby-forum.com/t/script-console-utf-8-macos-x/137118/4 "2008-05-12T20:06:37Z")

</div>

On May 11, 6:07 pm, Stedwick [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The $KCODE is set to UTF-8 and the MacOS X terminal preferences are  
> set to UTF-8 and the “escape non-ASCII characters” checkbox is NOT  
> checked. Again, pasting Chinese into the terminal works fine, it just  
> doesn’t work when script/console is running.
> 
> It’s not the end of the world of course, but I would appreciate any  
> ideas that you have 🙂

Try creating a UTF-8 file and piping it to script/console, instead of  
manually interacting. This can help you determine if it’s a script/  
console internal problem, or your terminal and script/console not  
playing nicely.

---

<div class="post-metadata">

**Author:** ![stedwick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/90ced4/32.png) [@stedwick](https://www.ruby-forum.com/u/stedwick)\
**Post date:** [May 20, 2008, 3:11pm UTC](https://www.ruby-forum.com/t/script-console-utf-8-macos-x/137118/5 "2008-05-20T15:11:16Z")

</div>

See this discussion for a possible remedy:

\< [No unicode in rails console - Rails I18n - Ruby-Forum](http://www.ruby-forum.com/topic/142493)\>

It’s a Ruby readline library problem…

izidor
