On Mon, Sep 21, 2009 at 03:26:35PM -0700, Robert Brewer wrote: > It looks simpler until you have a site that is not primarily utf-8. In > that case, you multiply your (1 line * number of middlewares in the WSGI > stack * each request). > With wsgi.uri_encoding you get either (1 line * 1 > middleware designed to transcode * each request), or even 0 if your > whole site uses just one charset.
I am not sure I understand your point. The 0 lines hold true if the whole site is using latin-1 or utf-8 and you write your applications/middlewares only for this site. But if it's using any other encoding you still have to transcode. def middleware(start_response, environ): value = environ['some_key'].\ encode('utf8', 'surrogateescape').\ decode(SITE_ENCODING) ... With wsgi.uri_encoding you would still have to do the following: def middleware(start_response, environ): value = environ['some_key'].\ encode(environ['some_key.encoding']).\ decode(SITE_ENCODING) ... Of course you can directly use `environ['some_key']` if you know you'll get the 'right' encoding all the time. But when the encoding changes, you'll have to fix all your middlewares. I am missing something? -- Henry PrĂȘcheur _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com