Re: behavior of set_content_type()

Hamish Lawson <[email protected]>
Newsgroups gmane.comp.web.quixote.user
Message-ID <[email protected]>
Neil Schemenauer wrote:

> On Tue, Aug 30, 2005 at 11:01:15AM +0100, Hamish Lawson wrote:
> > *If* Quixote is to adopt a policy of outputting a charset
> > parameter only for text/* types
.... 
> > But should Quixote adopt such a policy?
> 
> If I understand the HTTP specification, it should not.

I realise I had misread your proposal and that you weren't proposing that.

> If DEFAULT_CHARSET is utf-8 or utf-16, I think it would be
> ridiculous for Quioxte to produce a Content-Type header that was
> 'image/png; charset=utf-16'.  That seems very broken to me, even if
> the clients don't care.

Specifying any charset, not just UTF-8 or UTF-16, would be just as
"ridiculous". I agree it's not ideal to include a charset parameter
when it has no meaning for the content type. How about the following?
(See also my response to "Unicode improvements".)

* if charset is explicitly specified, use that
* if charset is not specified and you have a unicode object, use UTF-8
* if charset is not specified and you have a str object and the
content type is text/* then use ISO-8959-1
* otherwise omit the charset


Hamish
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.