Hello. I''ve started to study ruby and rails. I added string to the model: validates_length_of :first_name, :within => 3..64, :too_long => ''long'', :too_short => ''short'' It works. I changed error messges (I need to use russian words in it): validates_length_of :first_name, :within => 3..64, :too_long => ''Длинное'', :too_short => ''Короткое'' It doesn''t work. The error is: ... app/models/user.rb:3: invalid multibyte char (US-ASCII) ... Tried to find decision with google. Tried to use monkey patches: http://gist.github.com/273741 I dont''t now if my using was correct: I just created 3 files (patch.rb, fix_params.rb, fix_renderable.rb) in the folder config/ initializers - I didn''t require it anywhere (I think, that it happends automatically). Error changed to: ... incompatible character encodings: ASCII-8BIT and UTF-8 ... This error is in ruby, not in rails: D:/WebProgramming/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/ lib/active_support/core_ext/string/output_safety.rb:34:in `concat'' ... My configuration: ruby 1.9.1 rails 2.3.5 Windows XP Redactor is Aptana - it uses utf8 as default What have I to do to russian words become to work (utf8)? I want to find decision for Windows Ruby 1.9.1 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
kouzma wrote:> Hello. > I''ve started to study ruby and rails. > > I added string to the model: > validates_length_of :first_name, :within => 3..64, :too_long => > ''long'', :too_short => ''short'' > It works. > > I changed error messges (I need to use russian words in it): > validates_length_of :first_name, :within => 3..64, :too_long => > ''Длинное'', :too_short => ''Короткое'' > It doesn''t work. The error is: > ... app/models/user.rb:3: invalid multibyte char (US-ASCII) ... > > Tried to find decision with google. Tried to use monkey patches: > http://gist.github.com/273741 > I dont''t now if my using was correct: I just created 3 files > (patch.rb, fix_params.rb, fix_renderable.rb) in the folder config/ > initializers - I didn''t require it anywhere (I think, that it > happends automatically). > Error changed to: > ... incompatible character encodings: ASCII-8BIT and UTF-8 ... > This error is in ruby, not in rails: > D:/WebProgramming/Ruby19/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/ > lib/active_support/core_ext/string/output_safety.rb:34:in `concat'' > ... > > My configuration: > ruby 1.9.1 > rails 2.3.5 > Windows XP > Redactor is Aptana - it uses utf8 as default > > What have I to do to russian words become to work (utf8)? I want to > find decision for Windows Ruby 1.9.1Have you tried putting # encoding: utf-8 as the first line of that model''s file? http://blog.nuclearsquid.com/writings/ruby-1-9-encodings and http://blog.grayproductions.net/articles/ruby_19s_string are good articles to help beginning to understand Ruby 1.9''s encoding agnosticism. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.