I cannot get python CGI to print Hebrew characters to an html webpage on Linux. This is a script which demonstrates the problem:
#!/usr/bin/python3
print('Content-Type: text/html; charset=utf-8\n\n')
print ('<html><body>')
print ('first')
print ('second')
print ('תמות')
print ('third')
print ('</body></html>')
The file is saved in utf-8 (without BOM). I call this .cgi script directly from the browser address bar. The output is:
first second
While the Hebrew word and whatever follows are missing. No error shows in apache log or with cgitb enabled
I tested with apache 2.2 and python 3.2, on both Linux ubuntu 12.04 and centos 6, with Firefox, chrome and IE. And of course I can see Hebrew on any plain html page. On windows it works just fine.
Edit: while the final solution is indeed given by the linked question, this is still not a duplicate. See my comments below.