convert special characters but not tags
Posted
by Tom
on Stack Overflow
See other posts from Stack Overflow
or by Tom
Published on 2009-12-08T08:13:19Z
Indexed on
2010/04/08
16:03 UTC
Read the original article
Hit count: 365
I've got some text which needs converting to use HTML entities, but it also contains tags. Here's a sample:
<p>Ofcom issued the warning to Global-owned GWR in Bristol – which is required to operate as a "contemporary and chart music and information station" – for operating outside the music </p>
The (" and -) need to be converted but the paragraph tags must remain HTML. Using something like htmlentities converts everything, how can I convert everything but the tags?
© Stack Overflow or respective owner