durusmail: quixote-users: Unicode? scgi restart?
Unicode? scgi restart?
2003-11-14
2003-11-14
2003-11-14
2003-11-14
2003-11-14
2003-11-14
2003-11-14
Re: Unicode?
2003-11-14
2003-11-14
2003-11-14
2003-11-14
2003-11-14
Unicode? scgi restart?
Neil Schemenauer
2003-11-14
On Fri, Nov 14, 2003 at 10:28:09AM -0600, Skip Montanaro wrote:
> Got some ideas and/or pointers?  This is important enough to me to spend
> some effort on the subject, but I don't yet have any working familiarity
> with the Quixote code.
>
> In the best of worlds, I would like to just set
>
>     ENCODING = "utf-8"
>
> in my config file and have Quixote simply handle Unicode automagically.

I'm not familiar with Unicode to give you much help, unfortunately.
You will want to look at html.py, http_response.py, and either
_py_htmltext.py or _c_htmltext.c.

HTTPResponse.set_body already sets the charset to iso-8859-1.  That
should be configurable, I guess.  html.py and the htmltext
implementations call str() in places.  That will give you trouble.

Ideally, I guess response bodies should either be an octet stream
(commonly referred to as bytes) or they should be an array of
characters (in Python I think that means Unicode).  If they are
characters than they would serialized using the encoding specified
by the response object before being sent over the wire.

So, I think [html] templates should accumulate Unicode characters
rather than octets.  If you want to generate an octet stream (e.g. a
binary image) you would need to use a function or maybe a plain text
template.

Does that make sense?

  Neil

reply