On Tue, 22 Mar 2011 22:38:57 +0200, Ben Hayden <[email protected]> wrote:
Right now, I am returning some XML string content that is a unicode
string
in python, when I try to return this content via mod_wsgi, I get this
error:
[Tue Mar 22 15:31:30 2011] [error] [client 10.10.10.178] mod_wsgi
(pid=26149): Exception occurred processing WSGI script
'/srv/nfs/britecore/apache/britecore.wsgi'.
[Tue Mar 22 15:31:30 2011] [error] [client 10.10.10.178] TypeError:
sequence
of byte string values expected, value of type unicode found
Is this to be expected? Or did I mess something up on the configuration?
Also, is the solution just to run a .encode('ascii') on all contents I
send
out? How would I deal with UTF-8 characters then?
mod_wsgi doesn't (and shouldn't) enforce a specific encoding. As your
application should specify the charset anyway in headers "Content-type:
application/xml; charset=utf-8", it is also your application's
responsibility to encode the message with that charset, e.g. do
.encode('utf-8') for the unicode text.
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.