Hey everyone Is there a way to remove the charset= from the Content-Type response header? I''m using mongrel and it puts out a content-type like this for for playlist files: Content-Type: audio/x-scpls; charset=utf-8 I set the content type to ''audio/x-scpls'', but mongrel tacks on the ;xxxxx Everything after the ; causes problems with some web browsers when they try to launch an external application, like Winamp. Thanks for reading. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
How are you setting the content-type? In the two ways I tried, mongrel never added the charset... 1) 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 ... 2) Serving a file and having DirHandler serve the file, and using DirHandler.add_mime_type to return the right mime-type. $ cat config/mongrel.conf DirHandler.add_mime_type ''.pls'', ''audio/x-scpls'' $ lwp-request -e http://localhost:3000/test.pls ... Content-Type: audio/x-scpls ... On Apr 19, 9:42 am, Brandon Casci <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hey everyone > > Is there a way to remove the charset= from the Content-Type response > header? > > I''m using mongrel and it puts out a content-type like this for for > playlist files: > > Content-Type: audio/x-scpls; charset=utf-8 > > I set the content type to ''audio/x-scpls'', but mongrel tacks on the > ;xxxxx > > Everything after the ; causes problems with some web browsers when they > try to launch an external application, like Winamp. > > Thanks for reading. > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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... > > 1) 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 > ... > > 2) Serving a file and having DirHandler serve the file, and using > DirHandler.add_mime_type to return the right mime-type. > > $ cat config/mongrel.conf > DirHandler.add_mime_type ''.pls'', ''audio/x-scpls'' > $ lwp-request -e http://localhost:3000/test.pls > ... > Content-Type: audio/x-scpls > ... > > On Apr 19, 9:42 am, Brandon Casci <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Apr 19, 4:02 pm, Brandon Casci <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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... > > > 1) 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 -ehttp://localhost:3000/test > > ... > > Content-Type: audio/x-scpls > > ... > > > 2) Serving a file and having DirHandler serve the file, and using > > DirHandler.add_mime_type to return the right mime-type. > > > $ cat config/mongrel.conf > > DirHandler.add_mime_type ''.pls'', ''audio/x-scpls'' > > $ lwp-request -ehttp://localhost:3000/test.pls > > ... > > Content-Type: audio/x-scpls > > ... > > > On Apr 19, 9:42 am, Brandon Casci <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. > > On Apr 19, 4:02 pm, Brandon Casci <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---