instance method
charset=
Ruby on Rails 5.1.7
Since v5.0.7.2Signature
charset=(charset)
Sets the HTTP character set. In case of nil parameter it sets the charset to utf-8.
response.charset = 'utf-16' # => 'utf-16'
response.charset = nil # => 'utf-8'
Parameters
-
charsetreq
Source
# File actionpack/lib/action_dispatch/http/response.rb, line 259
def charset=(charset)
header_info = parsed_content_type_header
if false == charset
set_header CONTENT_TYPE, header_info.mime_type
else
content_type = header_info.mime_type
set_content_type content_type, charset || self.class.default_charset
end
end
Defined in actionpack/lib/action_dispatch/http/response.rb line 259
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Response