Page 1 of 1
Strip_html
Posted: Sun Oct 10, 2004 6:12 pm
by Shendemiar
If i want to convert all strings special characters to html-entites, but leave all the tags intact, what do i need to do?
Like:
aaa<b>ccÄdd</b>aa
would become:
aaa<b>cc&AUML;dd</b>aa
Posted: Sun Oct 10, 2004 6:16 pm
by feyd
[php_man]htmlentities[/php_man]() with a [php_man]str_replace[/php_man]() or two to "fix" the <> marks.
can also be done with a regular expression: [php_man]preg_replace[/php_man]() ... however, it may be more a pain to set up than it's worth.
Posted: Sun Oct 10, 2004 6:16 pm
by John Cartwright
[php_man]htmlentities[/php_man]
edit - beaten to it by feyd.... errrrrr
Posted: Sun Oct 10, 2004 6:20 pm
by Shendemiar
feyd wrote:[php_man]htmlentities[/php_man]() with a [php_man]str_replace[/php_man]() or two to "fix" the <> marks.
can also be done with a regular expression: [php_man]preg_replace[/php_man]() ... however, it may be more a pain to set up than it's worth.
Thanks, i made a function to do some str_replace to undo "<" ">" "/" loss...