Hi I''m trying to use german characters on a ruby on rails application, but for get ? on dropwdown menus. The database, tables and fields are encoded utf8_general_ci. I have this in my application controller: class ApplicationController < ActionController::Base before_filter :set_charset before_filter :configure_charsets def set_charset @headers["Content-Type"] = "text/html; charset=utf-8" end def configure_charsets @response.headers["Content-Type"] = "text/html; charset=utf-8" end end This in my environment.rb: ActiveRecord::Base.connection.execute ''SET NAMES UTF8'' and this in my database.yml Does anyone have an idea why this is not working (I can see using a breakpoint that it is wrong when imported into rails from mysql). Many thanks Darren -- 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
Hi Darren, 2007/1/18, Darren Evans <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> Does anyone have an idea why this is not working (I can see using a > breakpoint that it is wrong when imported into rails from mysql).Did you save your templates as UTF8? Did you use <meta http-equiv="content-type" content="text/html; charset=utf-8" /> in your header? With this 2 things I never had any trouble in Rails with german umlauts ;) Beate --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Darren Evans wrote:> Hi > > I''m trying to use german characters on a ruby on rails application, but > for get ? on dropwdown menus. The database, tables and fields are > encoded utf8_general_ci. I have this in my application controller: > > class ApplicationController < ActionController::Base > > before_filter :set_charset > before_filter :configure_charsets > > def set_charset > @headers["Content-Type"] = "text/html; charset=utf-8" > end > > def configure_charsets > @response.headers["Content-Type"] = "text/html; charset=utf-8" > end > > end > > This in my environment.rb: > > ActiveRecord::Base.connection.execute ''SET NAMES UTF8'' > > and this in my database.yml > > Does anyone have an idea why this is not working (I can see using a > breakpoint that it is wrong when imported into rails from mysql). > > Many thanks > > Darrenput this in hte database.yml adapter: mysql database: db_development encoding: utf8 username: root password: host: 127.0.0.1 works for me -- 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
Hi Thanks for the replies. It still doesn''t work, even with these modifications. It''s very strange, any other thoughts would be useful - I have to solve this somehow!! Thanks Darren Beate Paland wrote:> Hi Darren, > > 2007/1/18, Darren Evans <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: >> Does anyone have an idea why this is not working (I can see using a >> breakpoint that it is wrong when imported into rails from mysql). > > Did you save your templates as UTF8? Did you use > <meta http-equiv="content-type" content="text/html; charset=utf-8" /> > in your header? > > With this 2 things I never had any trouble in Rails with german umlauts > ;) > > Beate-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I have now solved it! You were right with your last modifications. I had to stop my rails server, then it worked. Thank you for your help, I really appreciate it. Darren Darren Evans wrote:> Hi > > Thanks for the replies. It still doesn''t work, even with these > modifications. > > It''s very strange, any other thoughts would be useful - I have to solve > this somehow!! > > Thanks > > Darren > > Beate Paland wrote: >> Hi Darren, >> >> 2007/1/18, Darren Evans <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: >>> Does anyone have an idea why this is not working (I can see using a >>> breakpoint that it is wrong when imported into rails from mysql). >> >> Did you save your templates as UTF8? Did you use >> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> >> in your header? >> >> With this 2 things I never had any trouble in Rails with german umlauts >> ;) >> >> Beate-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---