什么是 HTML 字符代码 8203?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2973698/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:19:46  来源:igfitidea点击:

What's HTML character code 8203?

htmlunicodecharacter-codes

提问by Kyle

What does the character code (HTML) ​? I found it in one of my jQuery scripts and wondered what it was..

字符代码 (HTML) 是​什么?我在我的一个 jQuery 脚本中找到了它,并想知道它是什么..

Thanks.

谢谢。

Edit:

编辑:

Here is the script it was in (it was added to the end, found it in Firebug)

这是它所在的脚本(它被添加到最后,在 Firebug 中找到)

<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript">
var $jnyh = jQuery.noConflict();


$jnyh(function() {
    $jnyh("#title-nyh").click(function() {
      $jnyh(".show-hide-nyh").slideDown("slow");
    }, function() {        
      if(!$jnyh(this).data('pinned'))
        $jnyh(".show-hide-nyh").slideUp("slow");
    });
    $jnyh("#title-nyh").click(function() {
    $jnyh(this).parent().toggleClass("title-btm-brdr");
       $jnyh(this).toggleClass("chev-up-result");
      var pin = $jnyh(this).data('pinned');
      $jnyh(this).data('pinned', !pin);
      if(pin) $jnyh(".show-hide-nyh").slideUp("slow");      
    });
});?&#8203;
</script>

回答by BalusC

It's the Unicode Character 'ZERO WIDTH SPACE' (U+200B).

它是Unicode 字符 'ZERO WIDTH SPACE' (U+200B)

this character is intended for line break control; it has no width, but its presence between two characters does not prevent increased letter spacing in justification

此字符用于换行控制;它没有宽度,但它在两个字符之间的存在并不能阻止在对齐中增加字母间距

As per the given code sample, the entity is entirely superfluous in this context. It must be inserted by some accident, most likely by a buggy editor trying to do smart things with whitespace or highlighting, or an enduser using a keyboard language wherein this character is natively been used, such as Arabic.

根据给定的代码示例,实体在此上下文中完全是多余的。它必须是由某种意外插入的,很可能是由一个有问题的编辑器试图用空格或突出显示来做聪明的事情,或者是最终用户使用本地使用该字符的键盘语言,例如阿拉伯语。

回答by Micros

If you want to search for these invisible characters in your editor and make them visible, you can use a Regular Expression searching for non-ascii characters. Try searching for [^\x00-\x7F]. Tested in IntelliJ IDEA.

如果要在编辑器中搜索这些不可见字符并使它们可见,可以使用正则表达式搜索非 ascii 字符。尝试搜索[^\x00-\x7F]. 在 IntelliJ IDEA 中测试。

回答by WarrenBee

I landed here with the same issue, then figured it out on my own. This weird character was appearing with my HTML.

我带着同样的问题来到这里,然后自己解决了。这个奇怪的字符出现在我的 HTML 中。

The issue is most likely your code editor. I use Espresso and sometimes run into issues like this.

问题很可能是您的代码编辑器。我使用 Espresso,有时会遇到这样的问题。

To fix it, simply highlight the affected code, then go to the menu and click "convert to numeric entities". You'll see the numeric value of this character appear; simply delete it and it's gone forever.

要修复它,只需突出显示受影响的代码,然后转到菜单并单击“转换为数字实体”。你会看到这个字符的数值出现;只需删除它,它就永远消失了。

回答by Chris Sattinger

The ZERO WIDTH SPACE character is inserted when you use jQuery to add elements using DOM manipulation functions like .before() and .after()

当您使用 jQuery 添加使用 .before() 和 .after() 等 DOM 操作函数的元素时,会插入零宽度空间字符

I've run into this when adding hidden modal dialog frames at the end of my document and then finding that the ZERO WIDTH SPACE screws up the layout down there, adding unwanted space.

我在文档末尾添加隐藏的模式对话框时遇到了这个问题,然后发现零宽度空间搞砸了那里的布局,增加了不需要的空间。

The quick fix was to insert it before the footer, not after it. Its hidden anyway.

快速修复是在页脚之前插入它,而不是在它之后。反正它是隐藏的。

I can't find anything in jQuery that does this:

我在 jQuery 中找不到任何可以执行此操作的内容:

https://github.com/jquery/jquery/blob/master/src/manipulation.js

https://github.com/jquery/jquery/blob/master/src/manipulation.js

So it might be the browser that adds it.

所以可能是浏览器添加了它。

回答by dan04

ZERO WIDTH SPACE.

ZERO WIDTH SPACE.

I've used it as content for "empty" table cells. No idea what it's doing in a <script>tag, though.

我已将其用作“空”表格单元格的内容。但是,不知道它在<script>标签中做什么。

回答by JAL

I have these characters show up in scripts where I do not desire them. I noticed because it ruins my HTML/CSS visual formatting : it makes a new text box.

我让这些字符出现在我不想要它们的脚本中。我注意到因为它破坏了我的 HTML/CSS 视觉格式:它创建了一个新的文本框。

Pretty sure a buggy editor is adding them... I suspect Komodo Edit for the Mac, in my case.

很确定一个有问题的编辑器正在添加它们......我怀疑 Mac 的 Komodo Edit,就我而言。

回答by zachaysan

If you're seeing these in a source be aware that it may be someone attempting to fingerprint text documents to reveal who is leaking information. It also may be an attempt to bypass a spam filter by making the same looking information different on a byte-by-byte level.

如果您在来源中看到这些,请注意可能是有人试图对文本文档进行指纹识别以揭示谁在泄露信息。这也可能是通过在逐字节级别上使外观相同的信息不同来绕过垃圾邮件过滤器的尝试。

See my articleon mitigating fingerprinting if you're interested in learning more.

如果您有兴趣了解更多信息,请参阅关于减轻指纹识别的文章

回答by Amr

It was displaying some weird characters (a?) until I set the charset to UTF-8 in the head of the html file

它显示了一些奇怪的字符(a?),直到我在 html 文件的头部将字符集设置为 UTF-8

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

or for HTML5:

或对于 HTML5:

<meta charset="UTF-8">

It it is now transparent but still shows in the html when I use the inspector.

它现在是透明的,但当我使用检查器时仍然显示在 html 中。

Removing all the scripts from the page didn't remove it either.

从页面中删除所有脚本也没有删除它。

I tested it for chrome and IE.

我针对 chrome 和 IE 对其进行了测试。