dream4s...@gmail.com writes: > I rename file from test.py in test.txt and all works fine. So clearly problem > it is not in file coding or browser. ANY IDEAS??
It looks like the encoding of stdout is not utf-8 in the CGI script. Check it with import sys print(sys.stdout.encoding) If it's not utf-8, you must force your output to be utf-8, as that is what the browser expects, because of your Content-type. You could use: sys.stdout.buffer.write('ранее предусматривалась смертная казнь.'.encode('utf-8')) Or to change stdout into utf-8 encoding: import codecs sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) [Note: I haven't tested this] -- Piet van Oostrum <p...@vanoostrum.org> WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list