display VARCHAR(mysql) and special chars in html

Wolfram Kraus kraus at hagen-partner.de
Wed Feb 23 03:00:40 EST 2005


Jonas Meurer wrote:
> hello,
> 
> my script selects a comment saved as VARCHAR in MySQL and displays it
> inside an html page.
> 
> the problem is, that the comment contains several special characters, as
> mysterious utf-8 hyphens, german umlauts, etc.
> 
> i could write a function to parse the comment and substitute special
> chars with the relevant html code, but maybe this already exists in some
> module?
> 
> if not, it'll be hard work, as i've to consider many special chars, and
> at least iso-8859-1* and utf-8 as charmaps.
> 
> bye
>  jonas
If I understand you correctly, just put

<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8">

somewhere in the <head>-section of you HTML-Page.

HTH,
Wolfram



More information about the Python-list mailing list