By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,353 Members | 1,555 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,353 IT Pros & Developers. It's quick & easy.

html entities and ampersands

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a

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.