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
Darren E. 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
Darren
put this in hte database.yml
adapter: mysql
database: db_development
encoding: utf8
username: root
password:
host: 127.0.0.1
works for me
Hi Darren,
2007/1/18, Darren E. [email protected]:
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
in your header?
With this 2 things I never had any trouble in Rails with german umlauts
Beate
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 P. wrote:
Hi Darren,
2007/1/18, Darren E. [email protected]:
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
in your header?
With this 2 things I never had any trouble in Rails with german umlauts
Beate
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 E. 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 P. wrote:
Hi Darren,
2007/1/18, Darren E. [email protected]:
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
in your header?
With this 2 things I never had any trouble in Rails with german umlauts
Beate