display VARCHAR(mysql) and special chars in html
deelan
ggg at zzz.it
Wed Feb 23 04:45:46 EST 2005
Jonas Meurer wrote:
(...)
> i've changed my plans, and now will transform the comments to html
> before saving them in mysql. this way, the comment never contains
> special chars except they weren't filtered out when safed in mysql.
>
> do any filters exist, to transform plain text to html? otherwise i might
> use third-party products, as text2html.
>
> what do you think?
as you may known mysql 4.1 offers utf-8 support. il would be
wise to keep everything as utf-8: db, html generation and finally
serve, with correct HTTP headers, pages encoded as utf-8.
to do this you might have to fiddle with mysql settings and make
sure that issuing a:
show varibles;
almost all of these settings:
character_set_client latin1
character_set_connection latin1
character_set_database latin1
character_set_results latin1
character_set_server latin1
character_set_system utf8
use utf-8 (as you can see my copy of mysql does not), otherwise i
think bad things will occur.
if you prefer to filter out weird characters and
encode as html &#xxxx entities textile[1] does the job
just fine, you can specify input and output encoding.
cheers,
deelan.
[1] http://dealmeida.net/en/Projects/PyTextile/
--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:nick "deelan" ;
foaf:weblog <http://blog.deelan.com/> .
More information about the Python-list
mailing list