Simple Unicode CGI Example (uniCGI.py) : Unicode : CGI Web PYTHON TUTORIALS


PYTHON TUTORIALS » CGI Web » Unicode »

 

Simple Unicode CGI Example (uniCGI.py)


#!/usr/bin/env python

CODEC = 'UTF-8'
UNICODE_HELLO = u'''
Hello!
u00A1Hola!
u4F60u597D!
u3053u3093u306Bu3061u306F!
'''

print 'Content-Type: text/html; charset=%sr' % CODEC
print 'r'13print '<HTML><HEAD><TITLE>Unicode CGI Demo</TITLE></HEAD>'
print '<BODY>'
print UNICODE_HELLO.encode(CODEC)
print '</BODY></HTML>'



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo CGI Web
» Unicode