Quantcast

charset breakage for binary types in chrome, ie

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

charset breakage for binary types in chrome, ie

chris_lewis
Hello,

My app generates and streams PDFs in some contexts, so I naturally used ContentType("application/pdf") in my response chain. I was surprised to find Chrome utterly failing; instead of its nice PDF viewer, I got only a blank screen. A bit of sniffing and I noticed that my content type was being augmented with "charset=utf-8." Removing ContentType from the chain fixed the problem, and scouring the web has confirmed that the charset issue with PDFs also exists in IE (at least 7 and 8, it seems). Refs:

https://issues.apache.org/jira/browse/WICKET-1388
http://trac.symfony-project.org/ticket/1811

Thinking about this, I don't think it makes sense to specify a charset for binary response types, be it PDF, MP3, whatever - though I'm not sure what the spec has to say about this.

I committed a fix to my fork; the idea being that text type objects should extend ContentType as usual, and binary types extend BinaryContentType (both mix in BaseContentType).

https://github.com/chrislewis/Unfiltered/commit/ab78e0be2b67c91155b37aae3e88148e00956bd0

What do you guys think?

Thanks,
chris
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: charset breakage for binary types in chrome, ie

n8han
Administrator
This looks great Chris, thanks for the contribution! I may give the non-charset appending one the name ContentType actually.

Nathan

On 11/28/2010 02:59 PM, chris_lewis [via Databinder] wrote:
Hello,

My app generates and streams PDFs in some contexts, so I naturally used ContentType("application/pdf") in my response chain. I was surprised to find Chrome utterly failing; instead of its nice PDF viewer, I got only a blank screen. A bit of sniffing and I noticed that my content type was being augmented with "charset=utf-8." Removing ContentType from the chain fixed the problem, and scouring the web has confirmed that the charset issue with PDFs also exists in IE (at least 7 and 8, it seems). Refs:

https://issues.apache.org/jira/browse/WICKET-1388
http://trac.symfony-project.org/ticket/1811

Thinking about this, I don't think it makes sense to specify a charset for binary response types, be it PDF, MP3, whatever - though I'm not sure what the spec has to say about this.

I committed a fix to my fork; the idea being that text type objects should extend ContentType as usual, and binary types extend BinaryContentType (both mix in BaseContentType).

https://github.com/chrislewis/Unfiltered/commit/ab78e0be2b67c91155b37aae3e88148e00956bd0

What do you guys think?

Thanks,
chris


View message @ http://databinder.3617998.n2.nabble.com/charset-breakage-for-binary-types-in-chrome-ie-tp5782398p5782398.html
To start a new topic under Unfiltered, email [hidden email]
To unsubscribe from Unfiltered, click here.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: charset breakage for binary types in chrome, ie

chris_lewis
Great! Thanks again for the continued work on unfiltered. It's coming along nicely and is a joy to work with.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: charset breakage for binary types in chrome, ie

n8han
Administrator
On 12/6/10 9:21 AM, chris_lewis [via Databinder] wrote:
> Great! Thanks again for the continued work on unfiltered. It's coming
> along nicely and is a joy to work with.

Good to hear! :)

For everybody's information, master now has the 030 branch merged into
it with some changes that will require refactoring in client code:
https://github.com/n8han/Unfiltered/blob/master/notes/0.3.0.markdown

(Whoa, github has a crazy new animation going on!)

Nathan
Loading...