[Python] Python CGI - UTF-8 doesn't work

Discussão em 'Python' iniciado por Stack, Fevereiro 11, 2025.

  1. Stack

    Stack Membro Participativo

    For HTML5 and Python CGI:

    If I write UTF-8 Meta Tag, my code doesn't work. If I don't write, it works.

    Page encoding is UTF-8.

    print("Content-type:text/html")
    print()
    print("""
    <!doctype html>
    <html>
    <head>
    <meta charset="UTF-8">
    </head>
    <body>
    şöğıçü
    </body>
    </html>
    """)


    This codes doesn't work.

    print("Content-type:text/html")
    print()
    print("""
    <!doctype html>
    <html>
    <head></head>
    <body>
    şöğıçü
    </body>
    </html>
    """)


    But this codes works.

    Continue reading...

Compartilhe esta Página