HTML: Should I encode greater than or not? ( > > )

后端 未结 6 681
梦如初夏
梦如初夏 2020-12-05 09:20

When encoding possibly unsafe data, is there a reason to encode >?

  • It validates either way.
  • The browser interprets the same either way
6条回答
  •  天命终不由人
    2020-12-05 09:51

    The HTML4 specification in its section 5.3.2 says that

    authors should use ">" (ASCII decimal 62) in text instead of ">"

    so I believe you should encode the greater > sign as > (because you should obey the standards).

提交回复
热议问题