Bryan Lawrence wrote: > Hi Folks > > I'm a bit of a late starter on this ... perhaps there needs to be a faq > on wsgi, paste and unicode ... > > Anyway, I have what I think is a valid unicode object (came from some > xml as usual), and I thought I was handling it just fine (but I can > never tell ... unicode just isn't as transparent as one would like), but > i get this (and similar with flup):
Your app should never return any unicode. You can wrap pieces in paste.lint or wsgiref.validate, which will possibly catch this error earlier. > ERROR:root:Traceback (most recent call last): > File "build/bdist.linux-i686/egg/wsgiutils/wsgiServer.py", line 131, > in runWSGIApp > self.wsgiWriteData (data) > File "build/bdist.linux-i686/egg/wsgiutils/wsgiServer.py", line 177, > in wsgiWriteData > self.wfile.write (data) > File "/usr/local/lib/python2.5/socket.py", line 254, in write > data = str(data) # XXX Should really reject non-string non-buffers > UnicodeEncodeError: 'ascii' codec can't encode character u'\xad' in > position 5710: ordinal not in range(128) > > Do I need to formally encode my base string somehow? I was under the > impression that unicode objects should work fine ... No, no unicode objects are allowed in WSGI. -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org _______________________________________________ Paste-users mailing list [email protected] http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users
