Вопрос

Are there any dangers of not properly encoding html chars such as £ and & ?

I know if you want to write :

It was nice & cost £1

your html would be :

It was nice & cost £1

But is there any danger if your html was :

It was nice & cost £1

Это было полезно?

Решение

You should encode the & as it has meaning in HTML and some parsers may not cope with it, even if most modern browsers can infer what you meant to do.

The £ however doesn't have to be encoded unless for some reason you have to encode your page as ASCII or if there's a risk of getting your character sets confused (e.g. UTF-8 vs ISO-8859-1).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top