151

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

Thanks.

Edit:

Here is the script it was in (it was added to the end, found it in 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>
Octavia Togami
  • 4,186
  • 4
  • 31
  • 49
Kyle
  • 65,599
  • 28
  • 144
  • 152
  • 1
    I found an article here that helps me: [js remove zero width space Unicode 8203 from string](https://stackoverflow.com/questions/24205193/) – Yuchi Aug 25 '18 at 18:10
  • 2
    Interesting. I just found it used to obfuscate an imgur URL in a scam email: https://i.i​m​g​u​r​.​c​o​m – Lambart Feb 11 '19 at 17:20
  • 1
    It's used on MDN manual… For example if you want to copy javascript object name from H1 title ( like https://developer.mozilla.org/en-US/docs/Web/API/NodeFilter ) ther's this character in "NodeFilter" string between small "e" and "F" … so it will fail in you script. I dont know why Mozilla using it… maybe just she hate us :D – iiic May 03 '19 at 14:30
  • 2
    @iiic Also used in the [php.net manual](https://www.php.net/manual/en/function.oci-get-implicit-resultset.php). I ended up with one of these squirely things in my php code. **oci_​field_​size** <- its in there twice! – nic Aug 19 '20 at 07:20

8 Answers8

184

It's the Unicode Character '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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 3
    Thanks. Strange how it ended up in my jQuery. – Kyle Jun 04 '10 at 11:44
  • You're welcome. You might just read the function what it is doing with this character :) – BalusC Jun 04 '10 at 12:01
  • I was just wondering as I'm having some issues with scripts in my page, so wondered exactly what this was and if it would interfere with other functions. – Kyle Jun 04 '10 at 12:14
  • 1
    @Kyle I've found this character in my CSS files and it tends to break them such that browsers don't parse my CSS properly. So I wouldn't be surprised if it might cause problems in script files. – AaronLS Mar 15 '12 at 22:10
  • @AaronLS: That's exactly what happened with my script, thanks for the confirmation. – Kyle Mar 16 '12 at 05:38
  • 1
    "It must be inserted by some accident" - it's also known as a byte order mark. – Jonathan Dickinson Apr 29 '14 at 13:23
  • I had this issue and it was from copying some text (in this case a class name) from an email in Outlook. It's most probably the HTML email that is generating this invisible character. Lesson learnt - Don't copy and paste! – hcharge Jun 16 '14 at 15:02
  • 10
    @Jonathan: It's very definitely not a [byte order mark](http://en.wikipedia.org/wiki/Byte_order_mark). – BalusC Feb 06 '15 at 08:27
  • @BalusC http://en.wikipedia.org/wiki/Byte_order_mark#UTF-16 - I've seen U+200B used by Visual Studio, consistently, as a BOM. – Jonathan Dickinson May 07 '15 at 08:52
  • 3
    @Jonathan: No, not as a BOM. As visual (mis)representation of the BOM. – BalusC May 07 '15 at 09:39
  • 1
    Found this, myself, inserted by SharePoint into a multi-line text field when I was trying to read it's HTML. I was using IE, not Espresso like WarrenBee mentioned in his answer. When it was empty, it was `

    `, but I couldn't rely on `.html().length > 0` meaning that I had text because of this stupid character being between the `

    `, making the length always > 0. So I had to do a `for` loop through all characters, using `.charAt(i).charCodeAt()`, and tested if the length was 1 but not character 8203, if the user had only entered in one character. Hell.
    – vapcguy Jun 22 '15 at 16:30
  • It exists everywhere in Google Doc. Is it "superfluous"? – Paul Lan Jun 12 '17 at 01:10
  • 1
    I just found this character at the beginning of lines that I had pasted from Microsoft Teams. I was wondering why the `file` command reported the file as UTF-8 text when I thought it was ASCII. Then I discovered these weird invisible characters. – JoelFan Nov 05 '20 at 01:12
  • I just wasted two days debugging my soap requests system because of this character in address string. I wonder how it ended up there. Probably copied from documentation. xD – Igor Atsberger Jun 13 '22 at 10:53
25

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.

Micros
  • 5,966
  • 2
  • 28
  • 34
  • 5
    we're not supposed to comment just to say thank you -- but this was so valuable. other people need to know this is the solution they are looking for when trying to clean text from quirky systems. when i say quirky i mean Microsoft 360 free website garbage! i'm very good with regular expressions having years of experience, but it just doesn't really matter when you encounter something you don't know how to target. (i tried working with `get_html_translation_table(HTML_ENTITIES)` and `ord()` but still couldn't win) this finally gave me the handle i needed to move forward! THANK YOU!!! – aequalsb Feb 17 '17 at 22:26
  • Some further explanation can be found at http://stackoverflow.com/questions/9868796/how-to-display-hidden-characters-by-default-zero-width-space-ie-8203/36495949#36495949. Glad it helped you @aequalsb – Micros Feb 20 '17 at 10:26
  • 3
    Works also with VSCode's search; be sure to use the "Use regex search" toggle. – James Perih Jan 29 '18 at 05:11
  • Worked in Notepad ++ as well if you need light and free software. – erp_da Apr 08 '22 at 17:34
7

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

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

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.

WarrenBee
  • 107
  • 2
  • 7
4

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 article on mitigating fingerprinting if you're interested in learning more.

zachaysan
  • 1,726
  • 16
  • 32
3

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

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:

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

So it might be the browser that adds it.

Chris Sattinger
  • 4,446
  • 3
  • 30
  • 29
3

ZERO WIDTH SPACE.

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

pinkgothic
  • 6,081
  • 3
  • 47
  • 72
dan04
  • 87,747
  • 23
  • 163
  • 198
2

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.

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

JAL
  • 21,295
  • 1
  • 48
  • 66
  • I doubt it. Shows up in IE on my PC when I looked at the `.html()` of a div that represented a textbox in SP 2013. I believe it is due to the behavior of the web application displaying the data. In my case, the length was 1, for me, when it should have been 0. It was due to this character. – vapcguy Jun 22 '15 at 16:34
0

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

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

or for HTML5:

<meta charset="UTF-8">

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

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

I tested it for chrome and IE.

Amr
  • 574
  • 1
  • 11
  • 15