开发者

rails 2.3.5 setting content_type for the header and excluding charset

开发者 https://www.devze.com 2023-03-24 22:12 出处:网络
Rails 2.3.5 on Apache I trying to deliver content to a extremely picky client application which I don\'t control.

Rails 2.3.5 on Apache

I trying to deliver content to a extremely picky client application which I don't control.

The client expects to see this header: Content-Type: text/xml

When I try to return that with my dynamically rendered .erb I set the content type in the controller:

render :layout => false,  :content_type => 'text/xml'

I've also tried this based on my (obviously incorrect reading of the rails docs)

开发者_JS百科
render :layout => false,  :content_type => 'text/xml', :charset => nil

But that renders this as the header: Content-Type: text/xml; charset=utf-8

Unfortunately the client app (again not my fault) chokes on the ; charset=utf-8.

I tried the unaccepted answer on this SO question but it does not seem to work:

Remove charset from Rails content type

Can anyone point me to the correct way to set this header without a charset?

Thank you


Maybe this solution would work for you? Hope it is exactly your problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消