Can't print Chinese to HTTP
Gnarlodious
gnarlodious at gmail.com
Fri Dec 4 22:57:54 EST 2009
On Dec 1, 3:06 pm, Terry Reedy wrote:
> def print(s): return sys.stdout.buffer.write(s.encode('utf-8'))
Here is a better solution that lets me send any string to the
function:
def print(html): return sys.stdout.buffer.write(("Content-type:text/
plain;charset=utf-8\n\n"+html).encode('utf-8'))
Why this changed in Python 3 I do not know, nor why it was nowhere to
be found on the internet.
Can anyone explain it?
Anyway, I hope others with this problem can find this solution.
-- Gnarlie
More information about the Python-list
mailing list