大网数据广告活动
网站运营与故障问答

Spurious ​ or \u200b being injected into my code

· 52CE 我爱测

The problem When viewing the HTML output from my website using the code inspector within Google Chrome, I get the spurious character ​ being injected in my code (snipped screen capture below). It looks like &#8203 is a zero…

问题原文

原帖链接 · Chris Rogers · CC BY-SA 4.0

The problem

When viewing the HTML output from my website using the code inspector within Google Chrome, I get the spurious character ​ being injected in my code (snipped screen capture below).

It looks like &#8203 is a zero width space, but what is causing it?

To check it is not Google Chrome, I tried it in Firefox, and I get red dots, which if hovered, they show a caption of \u200b(snipped screen capture below).

I don't understand what is going on here because when, instead of visual mode, I view the block in HTML mode within WordPress (click the three dots on top of the block and click 'Edit as HTML') I have the following...

<p>Because it suggests something is being presented as science inaccurately or even deceptively, the term pseudoscience is often considered defamatory (<a href="https://plato.stanford.edu/entries/pseudo-science" target="_blank" rel="noreferrer noopener nofollow" aria-label=" (opens in a new tab)">Hansson, 2008</a>)​​. Accordingly, those termed as practising or advocating pseudoscience often dispute the characterization (<a href="https://en.wikipedia.org/wiki/Pseudoscience" target="_blank" rel="noreferrer noopener nofollow" aria-label=" (opens in a new tab)">“Pseudoscience,” n.d</a>.)​.</p>

No extra spaces or weird characters

What I have tried so far

  • Jetpack's spell checking facility adds code bloat which I had to manually remove so I disabled that and used Microsoft Word for spelling and grammar checking. This may have caused the issue, as suggested in comments, so I tried the suggestion to "put it in Notepad, then copy it again to the clipboard, and paste it on your WordPress", but the spurious injections are still there.
  • The same goes when adding a new article with the same information, but the notepad content pasted into the WordPress article content.
  • I have checked that it is not a plugin injecting the code by deactivating them one by one.

What is going on? How do I stop these spurious character codes being injected?

In case you need to see the full coding on the live site, go to http://www.whatstheproblem.co.uk/psychology/pseudoscience-in-psychology/ and it is in the last paragraph of the section "What is Pseudoscience?"

已采纳解答

原帖链接 · Chris Rogers · CC BY-SA 4.0

I have finally found the problem and an easy solution.

The culprit

Even though when trying to narrow down any plugins causing the problem, I worked out that the offending plugin was a plugin I no longer use (Academic Blogger's Toolkit) because of other issues with it.

The zero width spaces were added wherever inline citations were added into the content, and were left behind after the plugin was deleted.

Frustration with removal without having to completely retype the article

Now the plugin has been removed, the problem has been resolved (no more zero width spaces will be injected). However, there are some left behind, the article is long, and copying and pasting the article code from the HTML mode editor into Notepad or Microsoft Word will copy the zero width spaces. Copying and pasting from Notepad will copy the zero width spaces back into your code.

Frustration free easy resolution

Download and use Brackets (Free). When pasting the code into brackets, the zero width spaces are shown up as red dots.

Delete the red dots, and you will have code clean of the zero width spaces. You are then safe to copy and paste the code back into WordPress.

To make editing them out quicker, search and replace is available in Brackets (Ctrl + H in Windows) copy one of the red dots and paste it into the search box.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2019-05-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。