You need to add this to the response headers, either in specific actions
like this:
def list
@response.headers["Content-Type"] = "text/html;
charset=koi8-r"
end
Or in a before filter that you apply to as many actions as you want:
class FooController < ApplicationController
before_filter :set_content_type
def set_content_type
@response.headers["Content-Type"] = "text/html;
charset=koi8-r"
end
end
Note that Rails built in Action Cache will break your code if you use it -
Rails will send the default charset for cached requests, and Page Caching
may not work either.
-----Original Message-----
From: rails-bounces@lists.rubyonrails.org
[mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Mikhail Shevchuk
Sent: Wednesday, January 25, 2006 12:07 PM
To: rails@lists.rubyonrails.org
Subject: [Rails] how to define content charset?
I tried to define koi8-r charset in app/views/layouts/ like this:
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=koi8-r">
<title>Cpu: <%= controller.action_name %></title>
<%= stylesheet_link_tag ''scaffold'' %>
</head>
But it doesn''t work. I suppose WEBrick already sent utf8 charset in
it''s
header, didn''t it?
How can I do the subject?
_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails