1

i use rails 2.3.9 with ruby 1.9.2 and when i trying to update my model with some russian letters i have error in unicorn log:

Error during failsafe response: incompatible character encodings: UTF-8 and ASCII-8BIT
Read error: #<NoMethodError: undefined method `[]' for nil:NilClass>

trace look like this:

/home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:521:in process_client' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:594:in block in worker_loop' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:592:in each' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:592:in worker_loop' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:482:in block (2 levels) in spawn_missing_workers' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:479:in fork' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:479:in block in spawn_missing_workers' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:475:in each' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:475:in spawn_missing_workers' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:489:in maintain_worker_count' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn/http_server.rb:299:in join' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/lib/unicorn.rb:13:in run' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/gems/unicorn-3.0.1/bin/unicorn_rails:208:in <top (required)>' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/bin/unicorn_rails:19:in load' /home/rbdev/.rvm/gems/ruby-1.9.2-p0@rails2/bin/unicorn_rails:19:in `'

so, i can't detirminate the problem, the only thing i know - what problem in russia text ( when i update model with english letters - all is ok. what i can do ? (

3 Answers 3

1

You should ensure that your editor saves files in UTF-8. ASCII afaik is the first part of any charset. That should be the reason you don't get any errors when you leave out the russian chars.

Sign up to request clarification or add additional context in comments.

1 Comment

rbdev@Ubuntu-1004-lucid-64-minimal:~/sites/avantage/app/views/admin/categories$ file -i edit.html.haml edit.html.haml: text/plain; charset=us-ascii
1

I answered this one here, with a script. Why are all strings ASCII-8BIT after I upgraded to Rails 3?

You need

# coding: UTF-8

at the top of your files, with ruby 1.9. If that doesn't help, it might be your external dependency, such as DB.

Comments

0

you can use gem "russian" (gem is based on l18n) https://github.com/yaroslav/russian in model (instead of russian letters): Russian::translate(:some_word)

in config file (must be encoded in UTF-8): ru: some_word: 'это строка с русскими буквами (this is string with russian letters)'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.