Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When i upload my rails app via SFTP to production server which is running Ubuntu 10.04 LTS all cyrillic characters in my files look like this:

As you can see, only parts of words are broken. And because of this rails app doesn't start with syntax error.

Also i'm getting errors like

ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8)
share|improve this question
up vote 0 down vote accepted

Turns out ruby 1.9 gets default external encoding from environment variable $LANG. On my Ubuntu the following command outputs US-ASCII for some reason:

ruby -e 'puts'

So i added the following line to the end of /etc/environment file:

LANG = "en_US.UTF-8"

After that i rebooted the server and everything was ok.

If you don't want to change global locales on your system you can also add "magic comment" to the top of your .rb files to force encoding where needed.

# coding: utf-8 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.