Tuesday, April 01, 2008

Rails Content type header setting

Added utf-8 as the default charset for all renders. You can change this default using:
ActionController::Base.default_charset=(encoding) [DHH]

Added proper getters and setters for content type and charset [DHH]. Example of what we used to do:
response.headers["Content-Type"] = "application/atom+xml; charset=utf-8"

response.content_type = Mime::ATOM
response.charset = "utf-8"

No comments :