468,315 Members | 1,438 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

html entities and ampersands

my php script gets delivered text that contains special chars (like
german umlauts), and these chars may, may partially or may not be
coverted into html entities already. i don't know beforhand.

question: how to spot wether an ampersand is just an ampersand and
needs to be converted or is part of an html entity and must be left
alone?

any help appreciated, micha

Jul 17 '05 #1
2 4723
micha wrote:
my php script gets delivered text that contains special chars (like
german umlauts), and these chars may, may partially or may not be
coverted into html entities already. i don't know beforhand.

question: how to spot wether an ampersand is just an ampersand and
needs to be converted or is part of an html entity and must be left
alone?

any help appreciated, micha


http://ch2.php.net/html_entity_decode

Have PHP decode the entities, the remaining ampersands should be just
ampersands.

--
Markus
Jul 17 '05 #2

Markus Ernst wrote:
micha wrote:
my php script gets delivered text that contains special chars (like
german umlauts), and these chars may, may partially or may not be
coverted into html entities already. i don't know beforhand.

question: how to spot wether an ampersand is just an ampersand and
needs to be converted or is part of an html entity and must be left
alone?

any help appreciated, micha
http://ch2.php.net/html_entity_decode

Have PHP decode the entities, the remaining ampersands should be just

ampersands.

--
Markus


yes, brilliant idea.
decode any present entities, than encode the whole thing again to get
any entity encoded (which is the aim, probably didn't become clear in
my 1st post).

micha

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by yawnmoth | last post: by
6 posts views Thread by Horst Gutmann | last post: by
17 posts views Thread by mickjames | last post: by
5 posts views Thread by ion | last post: by
7 posts views Thread by ian ward | last post: by
6 posts views Thread by clintonG | last post: by
6 posts views Thread by Clodoaldo | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.