2.4.3.23. Python script does not output Cyrillic

If the Python script does not output lines containing Cyrillic characters, make changes to it and format the output similarly to the examples provided below.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print "Content-Type: text/html;charset=utf-8"
print

print "Привет, Мир!"
#!/usr/bin/python3
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

import sys
import codecs

sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())

print("Content-Type: text/html; charset=utf-8")
print()
print('Привет, мир!')
コンテンツ

    (1)