[CGI] Why is HTML not rendered?

Dan Sommers dan at tombstonezero.net
Fri Aug 17 09:41:52 EDT 2012


On 2012-08-17 at 15:27:59 +0200,
Regarding "[CGI] Why is HTML not rendered?,"
Gilles <nospam at nospam.com> wrote:

> For some reason, this CGI script that I found on Google displays the
> contents of the variable but the HTML surrounding it is displayed
> as-is by the browser instead of being rendered:

... [with all due respect and apologies to another thread on this list!]

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

That line tells the browser that the response is plain text.

Do this instead to have the browser render the HTML:

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

HTH,
Dan

-- 
Μὴ μοῦ τοὺς κύκλους τάραττε -- Αρχιμηδησ
Do not disturb my circles. -- Archimedes

Dan Sommers, http://www.tombstonezero.net/dan



More information about the Python-list mailing list