python cgi pages appear garbled Chinese

# ! G: /python3.6/python.exe 
# - * - Coding: UTF-8 - * - 
Print ( " Content-of the type: text / HTML " )
 Print ()               # blank line tells the server end head 
Print ( ' <HTML> ' )
 Print ( ' <head> ' )
 Print ( ' <Meta charset = "UTF-. 8"> ' )
 Print ( ' <title> HelloCGI Program! </ title> ' )
 Print ( ' </ head > ')
print('<body> ' )
 Print ( ' <H2> Word the Hello! why the PROGRAM distortion of the CGI </ H2> ' )
 Print ( ' </ body> ' )
 Print ( ' </ HTML> ' )

As a result, the title page Chinese and Chinese will be garbled

 

Solution:

Comment out print ( '<meta charset = "utf-8">'), like

1  # G: /python3.6/python.exe! 
2  # - * - Coding: UTF-8 - * - 
3  Print ( " Content-of the type: text / HTML " )
 4  Print ()               # blank line tells the server end head 
. 5  Print ( ' <HTML> ' )
 . 6  Print ( ' <head> ' )
 . 7  # Print ( '<Meta charset = "UTF-. 8">') 
. 8  Print ( ' <title> HelloCGI Program! </ title > ')
 9 print('</ head> ' )
 10  Print ( ' <body> ' )
 . 11  Print ( ' <H2> the Hello Word! the CGI the PROGRAM why distortion </ H2> ' )
 12 is  Print ( ' </ body> ' )
 13 is  Print ( ' </ HTML> ' )

 

Guess you like

Origin www.cnblogs.com/ningchenglong/p/11237032.html