Jump to content

& or &, this is question


son

Recommended Posts

I just validated some web pages and saw the following error:character "&" is the first character of a delimiter but occurred as dataDo I really need to replace & with &? What if user who will be using the character using this also on website? Do I have to worry about this?Thanks,Son

Link to comment
Share on other sites

& is the correct way. If you have user input on your site, it's your business to make sure that the text gets translated to proper HTML. With htmlspecialchars(), for example, if your user input is processed by PHP.

Link to comment
Share on other sites

& is the correct way. If you have user input on your site, it's your business to make sure that the text gets translated to proper HTML. With htmlspecialchars(), for example, if your user input is processed by PHP.
Thanks Ingolme. I suppose this applies to any html element, including meta and title tags? Also, do normal CMS systems that are on the market do the same you think? Just wonder how commercial software might deal with this (I am always keen to learn things in proper way if you know what I mean)...Son
Link to comment
Share on other sites

Yup, this is the proper way to do it for all elements. Most CMS systems probably use a function to encode the characters in displayed data: maybe PHP's htmlspecialchars(), as Ingolme mentioned.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...