If you use Rails, you want:
response.content_type = Mime::HTML
response.charset = "utf-8"
You can also try setting the headers directly:
response.headers["Content-Type"] = "text/html; charset=utf-8"
If you use Rack, you want to set the header using the second element of the tuple:
class MyRackApp
def call(env)
response = []
response[1]["Content-Type"] = "text/html; charset=utf-8"
response
end
end
If you are using the original CGI (I would definitely recommend Rack over cgi.rb):
header("text/html; charset=utf-8")
source
share