Difference between Url Encode and HTML encode

前端 未结 5 1217
情书的邮戳
情书的邮戳 2021-01-18 06:52

What’s the difference between an URL Encode and a HTML Encode?

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 07:54

    HTMLEncode and URLEncode deal with invalid characters in HTML and URLs, or more accurately, characters that need to be specially written to be interpreted correctly. For example, in HTML the < and > characters are used to indicate tags. Thus, if you wanted to write a math formula, something like 1+1 < 2+2, the '<' would normally be interpreted as the beginning of a tag. HTMLEncoding turns this character into "<" which is the encoded representation of the less-than sign. URLEncoding does the same, but for URLs, for which the special characters are different, although there is some overlap.

提交回复
热议问题