tag:blogger.com,1999:blog-6692866151143183230.post4319511416982966823..comments2024-03-19T16:22:18.277+05:30Comments on jugad2 - Vasudev Ram on software innovation: A basic WSGI PDF serverVasudev Ramhttp://www.blogger.com/profile/13568740634188042591noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-6692866151143183230.post-7629821321731162572013-11-15T22:20:18.055+05:302013-11-15T22:20:18.055+05:30Thanks for pointing that out.
Thanks for pointing that out.<br />Vasudev Ramhttps://www.blogger.com/profile/13568740634188042591noreply@blogger.comtag:blogger.com,1999:blog-6692866151143183230.post-81678491446587037112013-11-15T05:15:30.531+05:302013-11-15T05:15:30.531+05:30Please note that in Python 3 the returned iterable...Please note that in Python 3 the returned iterable needs to yield bytes objects, not (unicode) strings, so to make the example work under Python 2 and 3, you need to encode the response string and set the encoding in the Content-type header:<br /><br />encoding = 'utf-8'<br />headers = [('Content-type', 'text/plain; charset={}'.format( encoding))]<br />response = ''This is the page for "{}"'.format(path)<br /><br />start_response(status, headers)<br /><br />return [response.encode(encoding)]Chris Arndthttp://blog.chrisarndt.de/noreply@blogger.com