O
O
Oleg Pariyev2020-11-17 10:04:13
Python
Oleg Pariyev, 2020-11-17 10:04:13

Why do krakozyabry crawl out?

Just learning how to make a website using python. And I decided to make a page with the Russian language, but krakozyabry came out:

5fb375d5ee6dd468670364.png

I understand that the problem is with the encoding (most likely), but I just don’t understand where and how to fix it ...

Code:

#!/Python380/python 
print("Content-type: text / html")
print(
"""
<html lang="ru">
    <head>
        <meta charset="utf-8">
        <title>Проба с Python</title>
    </head>
    <body>
        <h1><b>Привет</b></h1>
    </body>
</html>
"""
)

python file encoding: UTF-8

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ross Alex, 2020-11-17
@DgDays

import sys
import codecs

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

D
Dr. Bacon, 2020-11-17
@bacon

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question