What's the HTML character entity for the # sign?

前端 未结 7 653
广开言路
广开言路 2021-02-06 20:28

What\'s the HTML character entity for the # sign? I\'ve looked around for \"pound\" (keeps returning the currency), and \"hash\" and \"number\", but what I try doesn\'t seem to

7条回答
  •  遇见更好的自我
    2021-02-06 21:05

    The "#" -- like most Unicode characters -- has no particular name assigned to it in the W3 list of "Character entity references" http://www.w3.org/TR/html4/sgml/entities.html . So in HTML it is either represented by itself as "#" or a numeric character entity "#" or "#" (without quotes), as described in "HTML Document Representation" http://www.w3.org/TR/html4/charset.html .

    Alas, all three of these are useless for escaping it in a URL. To transmit a "#" character to the web server in a URL, you want to use "URL encoding" aka "percent encoding" as described in RFC 3986, and replace each "#" with a "%23" (without quotes).

提交回复
热议问题