I just installed Apache 2, Phusion Passenger and Rails 2.2.2 on Centos 5.2 64 bit server.
My mysql database is latin1, and my setup works on php server, and my rails setup is also working besides character encoding with the data from database.
I have set
meta http-equiv="Content-Type" content="text/html;charset=iso8859-1" (omitting the brackets)
Inside the header, but when I look at the source of the page I see the header is correct, but when I run
HEAD http://servername/posts/show/2
I get utf-8 in the charset.
In short, I don't get unicode characters in the data from database, but unicode characters in the posts.html.erb do show up correctly.
So where is this header set, and what am I doing incorrectly ?
Edit, just adding the header I get by running HEAD
Cache-Control: private, max-age=0, must-revalidate
Connection: close
Date: Tue, 17 Feb 2009 16:59:32 GMT
ETag: "f242d9af7c676eb3f7b92f4c4f4b16d3"
Server: Apache/2.2.3 (CentOS)
Content-Length: 296
Content-Type: text/html; charset=utf-8
Client-Date: Tue, 17 Feb 2009 16:59:32 GMT
Client-Peer:
Client-Response-Num: 1
Set-Cookie: _html_session=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D–455dc90f774060b52ea418446bdf2774beea16d5; path=/; HttpOnly
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 2.0.6
X-Runtime: 21ms
Regards,
Trausti
Best Answer
To answer my own question. I was told that by adding this text
ActionController::Base.default_charset=("ISO-8859-1")
into envrionment.rb would fix the issue, and it does. It fixes my issue