You can run your python 27 code (each Python file) with
#!/usr/bin/python
But sometimes you need to use .encode ('ascii') if you use HMAC or you need to set HTTP headers. Or you can use:
self.response.headers[str('Content-Type')] = str(content_type)
or
self.response.headers[b'Content-Type'] = str(content_type)
And make sure that:
- all your html files use utf-8
- your editor uses utf-8 by default
source share