A
A
Arman2017-10-20 13:14:21
HTML
Arman, 2017-10-20 13:14:21

How dangerous is an ampersand in html output?

htmlspecialchars replaces "&" with "&"(The toaster is also buggy), but I can't figure out why it's dangerous. Editors (humans) use "& nbsp;", "& mdash;" (Toaster!!) and stuff like that, all the output is of course in htmlspecialchars, or what are alternatives from frameworks, and of course it's all replaced by " " in the text. How is it usually done here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lander, 2017-10-20
@Arik

Not dangerous. htmlspecialchars simply "escaps" the special characters so that when you output "&", "<" and ">" you will see exactly these characters, not converted to tags and special characters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question