[Twisted-web] Rendering unicode instances.

Syver Enstad twisted-web@twistedmatrix.com
28 Jan 2004 17:39:01 +0100


Donovan Preston <dp@divmod.org> writes:

> It's simple enough to implement. Here is what quotient does:
> 
>      def render(self, request):
>          request.setHeader("Content-type", 'text/html; charset=UTF-8')
> 
>          return renderer.Renderer.render(self, request)
> 
> And then, when it wants to present a unicode string, it does:
> 
> theStr.encode('utf8')

I have a host of places that writes out string data, and which does so
via woven, so I thought that wrapping the request output stream with
an encoding wrapper would do nicely instead of having to find everywhere there could come a unicode string and then convert it explicitly.

What about input? Form data and query strings.