I’m setting it the exact same way you are, but it always appends ‘;
charset=utf8’ to the end of content-type if I don’t specify my own
charset.
I’m going to try #2 as well.
A few minutes ago I found that eliminating Cache-Control from the header
made things work perfectly in versions of IE < 7. So maybe I really
don’t have to mess with the charset but I will try your suggestion.
Thank you for the tip!
Eden Li wrote:
How are you setting the content-type? In the two ways I tried,
mongrel never added the charset…
Setting headers[‘Content-Type’] in the rails action.
$ cat app/controllers/test_controller.rb
class TestController < ApplicationController
def test
headers[‘Content-Type’] = ‘audio/x-scpls’
render :text => ‘hi’, :layout => false
end
end
$ lwp-request -d -e http://localhost:3000/test
…
Content-Type: audio/x-scpls
…
Serving a file and having DirHandler serve the file, and using
DirHandler.add_mime_type to return the right mime-type.
Sounds like you’ve nicked it. Just one last thing… it looks like
Rails 1.2.x is adding the charset= bit, mongrel isn’t. When I tested
it I was using 1.1.6. Trying the same thing in 1.2.3 shows the
charset= in the response headers.
Ya, thats what I thought too. I started poking around in the rails code
and I think I saw thing in ActionController. I’m not sure it’s a big
deal anymore. I think it’s more likely that the lack of or presence of
certain values in the http header was causing my problem across
different browsers. I made a poor initial guess.
Eden Li wrote:
Sounds like you’ve nicked it. Just one last thing… it looks like
Rails 1.2.x is adding the charset= bit, mongrel isn’t. When I tested
it I was using 1.1.6. Trying the same thing in 1.2.3 shows the
charset= in the response headers.