这个 INSANE 空间字符是什么???(谷歌浏览器) [英] What is this INSANE space character??? (google chrome)
问题描述
这绝对让我着迷,!&&%&$ 疯了......它无视我能想到的一切.
This is driving me absolutely, !&&%&$ insane... it defies everything that I can think of.
这个字符就在这里... " "
THIS character right here... " "
在这些引号之间...打开谷歌浏览器并检查.你会看到一个
... 正常吗?现在右键单击并实际查看此堆栈溢出页面的来源.这是一个普通的空格...(还有,我复制的字符是一个实际的空格).
In between these quotes... open google chrome and inspect. You will see its a
... normal right? Now right click and actually view the source of this stack overflow page. It's a regular space... (also, the character I copied was an actual space).
我可以理解它是否是某种富文本编辑器或其他东西,但在原始 html 源代码中是一个常规空间,那么是什么给出的?
I could understand if it's some kind of rich text editor or something, but in the raw html source is a regular space, so what gives?
这里只是按空格键(效果很好)... " "
.
Here's just with hitting the space key (which works fine)... " "
.
您甚至可以将其复制并粘贴到任何地方,然后大肆破坏并使 chrome 将
放在任何地方.即使在剪贴板中复制的内容只是一个空格.
You can even copy it and paste it everywhere and wreak havoc and make chrome put
everywhere. Even though whats copied in your clipboard is just a SPACE.
这些愚蠢的字符随机出现在我的网站上,我不知道它们来自哪里,或者为什么谷歌将空格转换为 nbsp;
I have these stupid characters show up everywhere randomly in my website and I have no idea where they come from, or WHY is google converting a SPACE into a nbsp;
我试过检查实际的字符代码,它是我能找到的所有东西的常规空间......
I have tried inspecting the actual character code and it's a regular space from all things I can find...
我尝试的每一种方法都将它显示为一个正常空间......那是什么?
Every single method I try shows it as a NORMAL space... so what gives?
如果我使用 ruby 并执行 " ".ord
我得到 32
.如果我用损坏的空间来做,我也会得到 32
.
If i use ruby and do " ".ord
I get 32
. If i do it with the broken space I also get 32
.
请帮助我失去理智.
编辑:您可以证明这一点...查看此页面上的源代码,您将像平常一样看到两个空的 " "
.现在查看控制台,只有一个是
,但原始源代码是相同的.
edit: you can prove this... view source on this page and you will see two empty " "
like normal. Now look in console and only the one will be a
, yet the raw source is identical.
不使用 chrome 的人的图像(这是通过 chrome 开发工具查看这篇文章):
Image for people not using chrome (this is looking at this very post via chrome dev tools):
这是您在查看源代码时看到的相同文本的 HTML ......没有找到.
Here's the HTML of the same text you see when you view source... no nbsp to be found.
推荐答案
当我在 Internet Explorer 中查看此页面的源代码,或直接从服务器下载并在文本编辑器中查看时,第一个空格字符被格式化在实际的 HTML 中是这样的:
When I view this page's source in Internet Explorer, or download it directly from the server and view it in a text editor, the first space character in question is formatted like this in the actual HTML:
THIS character right here... " "
注意  
实体.那就是 Unicode 代码点 U+00A0 NO-BREAK SPACE
.在检查 HTML 时,Chrome 只是很好并将其重新格式化为
.但是请不要误会,它是一个真正的不间断空格,而不是您期望的 Unicode 代码点 U+0020 SPACE
.U+00A0
在视觉上与 U+0020
相同,但它们是语义不同的字符.
Notice the  
entity. That is Unicode codepoint U+00A0 NO-BREAK SPACE
. Chrome is just being nice and re-formatting it as
when inspecting the HTML. But make no mistake, it is a real non-breaking space, not Unicode codepoint U+0020 SPACE
like you are expecting. U+00A0
is visually displayed the same as U+0020
, but they are semantically different characters.
有问题的第二个空格字符在实际 HTML 中的格式如下:
The second space character in question is formatted like this in the actual HTML:
<p>Here's just with hitting the space key (which works fine)... <code>" "</code>.</p>
所以它是 Unicode 代码点 U+0020
而不是 U+00A0
.查看此页面的原始十六进制数据确认:
So it is Unicode codepoint U+0020
and not U+00A0
. Viewing the raw hex data of this page confirms that:
这篇关于这个 INSANE 空间字符是什么???(谷歌浏览器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!