# 符号的 HTML 字符实体是什么?
# 符号的 HTML 字符实体是什么?我四处寻找“英镑”(不断返回货币)、“哈希”和“数字”,但我尝试的似乎没有变成正确的字符。
What's the HTML character entity for the # sign? I've looked around for "pound" (which keeps returning the currency), and "hash" and "number", but what I try doesn't seem to turn into the right character.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
您可以在 fileformat.info 上搜索单个字符。输入
#
作为搜索字符串,第一次点击将引导您到 U+0023。向下滚动到第二个表编码,您将在以下每个条目下看到:You can search it on the individual character at fileformat.info. Enter
#
as search string and the 1st hit will lead you to U+0023. Scroll a bit down to the 2nd table, Encodings, you'll see under each the following entries:对于
#
,我们有#
。但请记住,它是一个新实体(例如,IE9 无法识别它)。为了获得广泛的支持,正如其他人所说,您必须求助于数字引用
#
以及十六进制的#
。如果您需要了解其他工具,这里有一些非常有用的工具。
For
#
we have#
.Bear in mind, though, it is a new entity (IE9 can't recognize it, for instance). For wide support, you'll have to resort, as said by others, the numerical references
#
and, in hex,#
.If you need to find out others, there are some very useful tools around.
“#”——像大多数 Unicode 字符一样——在 W3 列表中没有为其分配特定的名称。
“角色实体参考”
http://www.w3.org/TR/html4/sgml/entities.html
。
因此,在 HTML 中,它要么由自身表示为“#”,要么由数字字符实体“#”表示或“#” (不带引号),如中所述
《HTML 文档表示》
http://www.w3.org/TR/html4/charset.html
。
唉,这三个对于在 URL 中转义它来说都是无用的。
要将“#”字符传输到 URL 中的 Web 服务器,您需要使用“URL 编码”又名“百分比编码”(如 RFC 3986 中所述),并将每个“#”替换为“%23”(不带引号) 。
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).
#
字符没有 HTML 字符实体,因为该字符在 HTML 中没有特殊含义。如果您出于某种原因希望对其进行 HTML 编码,则必须使用像
#
这样的字符代码实体。There is no HTML character entity for the
#
character, as the character has no special meaning in HTML.You have to use a character code entity like
#
if you wish to HTML encode it for some reason.http://www.asciitable.com/ 有信息。维基百科也有大多数 unicode 字符的页面。
http://en.wikipedia.org/wiki/Number_sign
http://www.asciitable.com/ has information. Wikipedia also has pages for most unicode characters.
http://en.wikipedia.org/wiki/Number_sign
数字参考是
#
。The numerical reference is
#
."#"的显示方式有多种,如下所示:
另外,您还可以显示"♯",它与"#"不同在某些方面如下所示:
You can display "#" in some ways as shown below:
In addtion, you can display "♯" which is different from "#" in some ways as shown below:
我们在这里得到了一些疯狂的答案,实际上我们可能需要剪掉头发来确定它是否符合 HTML 实体的资格,但我相信您正在寻找的是命名锚点。
这允许通过超链接引用 HTML 文档中的不同部分,并专门使用 octothorp(哈希符号、数字符号、井号符号)
exampleDomain.com/exampleSilo/examplePage.html#2ndBase
将是以下示例它是如何使用的。
We've got some wild answers here and actually we might have to cut hairs to determine if it qualifies as an HTML Entity, but what I believe you're looking for is the named anchor.
This allows references to different sections within an HTML document via hyperlink and specifically uses the octothorp (hash symbol, number symbol, pound symbol)
exampleDomain.com/exampleSilo/examplePage.html#2ndBase
Would be an example of how it's used.
标准方法是以下任何一种:
#
#
#
但是我遇到了一个问题当我们需要保持编码(以便我们自己的工具进一步处理)时,我们使用的外部工具会将页面源代码中的所有这些替换为
#
。您可以使用 数字符号,而不是使用 数字符号 /U+FF03" rel="nofollow noreferrer">全角数字符号,使用以下任一选项:
#
#
这两个井号在我的 Windows 系统上看起来几乎相同:
# 与 #
(正常的在左边,全角的在右边)
The standard way is any of these:
#
#
#
However I was coming across an issue where an external tool we use would replace all of these with
#
in the page's source code, when we needed it to be kept encoded (for further processing by our own tools).Instead of using a number sign you can use a full-width number sign using either of these:
#
#
The two hash-signs look virtually identical on my Windows system:
# vs. #
(Normal one on the left, full-width one on the right)
# 是最好的选项,因为它是唯一不包含 #(哈希)的选项。无论旧浏览器是否支持,这都是未来的最佳实践。
(使用您正在编码的相同符号对某些内容进行编码有什么意义?)
# is the best option because it is the only one that doesn't include the # (hash) in it. Supported by old browsers or not, it is the best practice going forward.
(What is the point of encoding something using the same symbol you are encoding?)