문제

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