问题描述
这让我绝对,!&&%& $疯狂...它违反了我能想到的一切。
...
在这些引号之间...打开google chrome和inspect。你会看到它的& nbsp;
...正常吗?现在右键单击并实际查看此堆栈溢出页面的源。这是一个常规的空间...(也,我复制的字符是一个实际的空间)。
我可以理解,如果它是一种富文本编辑器或东西,在原始html源中是一个常规空间,所以什么给了?
这里只是打空格键(这很好)...
。
你甚至可以复制它,并将其粘贴到任何地方,并造成严重破坏,使chrome put & nbsp ;
无处不在。即使在您的剪贴板中复制的只是一个空格。
我有这些愚蠢的字符随处出现在我的网站,我不知道他们来自哪里, WHY是google将一个SPACE转换为一个;
我已经尝试检查实际的字符代码,这是一个常规的空间,从所有的东西,我可以找到...
我尝试的每一个方法都显示为一个NORMAL空间...所以什么给了?
如果我使用ruby和do .ord
我得到 32
。如果我用破碎的空间做,我也得到 32
。
请帮我失去我的心。 / p>
编辑:您可以证明这一点...在此页面上查看源代码,您会看到两个空的 / code>像正常。现在看看控制台,只有一个将是
& nbsp;
,但原始来源是相同的。
未使用Chrome的用户的图片(这是通过chrome开发工具查看这篇帖子的):
这是您在查看来源时看到的相同文字的HTML ...找不到。
当我在Internet Explorer中查看此页面的源代码或直接从服务器下载并在文本编辑器中查看时,所讨论的第一个空格字符在实际HTML中的格式如下:
这个字元在这里... &
请注意 
实体。这是Unicode码点 U + 00A0 NO-BREAK SPACE
。 Chrome只是很好,并重新格式化为& nbsp;
时检查的HTML。但不要犯错,它是一个真正的不间断的空间,不是Unicode码点 U + 0020 SPACE
像你所期望的。 U + 00A0
在视觉上显示与 U + 0020
相同,但它们是语义上不同的字符。
问题中的第二个空格字符在实际HTML中的格式如下:
< p>这里只是按下空格键(可以正常工作)...< code>< / code>。< / p>
所以它是Unicode代码点 U + 0020
而不是 U + 00A0
。查看此页面的原始十六进制数据确认:
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).
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)... " "
.
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.
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?
If i use ruby and do " ".ord
I get 32
. If i do it with the broken space I also get 32
.
Please help me im losing my mind.
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.
Image for people not using chrome (this is looking at this very post via chrome dev tools):
Here's the HTML of the same text you see when you view source... no nbsp to be found.
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... " "
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.
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>
So it is Unicode codepoint U+0020
and not U+00A0
. Viewing the raw hex data of this page confirms that:
这篇关于什么是INSANE空格? (谷歌浏览器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!