{"id":6093,"date":"2012-11-14T07:00:00","date_gmt":"2012-11-14T15:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2012\/11\/14\/break-it-up-you-two-the-zero-width-non-joiner\/"},"modified":"2019-06-09T15:17:59","modified_gmt":"2019-06-09T22:17:59","slug":"break-it-up-you-two-the-zero-width-non-joiner","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20121114-00\/?p=6093","title":{"rendered":"Break it up, you two!: The zero width non-joiner"},"content":{"rendered":"<p>Keytips are those little pop-up keyboard accelerator thingies that appear on the Ribbon when you tap the Alt key:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/web.archive.org\/web\/20140424222948if_\/http:\/\/i.msdn.microsoft.com\/dynimg\/IC510585.png\" width=\"355\" height=\"318\" \/><\/p>\n<p>A tester discovered that when a test tried to read the accessibility name for a Ribbon keytip, &#8220;an extra character appears after every keytip character.&#8221; In the above example, the keytip for &#8220;Tab 1&#8221; was being read back as<\/p>\n<pre>46 00 0C 20 46 00 0C 20\r\n----- ----- ----- -----\r\n  F   ?????   F   ?????\r\n<\/pre>\n<p>The question marks are U+200C, formally known as <a href=\"http:\/\/www.fileformat.info\/info\/unicode\/char\/200c\/index.htm\"> ZERO WIDTH NON-JOINER<\/a>. Michael Kaplan <a href=\"http:\/\/archives.miloush.net\/michkap\/archive\/2006\/02\/15\/532394.html\"> discussed the character (and its evil twin the ZERO WIDTH JOINER) some time ago<\/a>.<\/p>\n<p>The ZERO WIDTH NON-JOINER (or ZWNJ to his friends) is a hint to the font engine that the characters on opposite sides of the ZWNJ should not be combined into a ligature. In English, the ZWNJ would prevent two consecutive lowercase &#8220;f&#8221;s from being converted into a &#8220;\ufb00&#8221; ligature. Ligatures are fading from use in contemporary printing, probably due to the rise of computers. Back in the old days, you saw all sorts of neat ligatures, like &#8220;\ufb06&#8221;.<\/p>\n<p>Breaking up the ligature is important when presenting keyboard accelerators. Imagine if the keyboard accelerator for a key sequence was &#8220;A&#8221; followed by &#8220;E&#8221;. If this were displayed as &#8220;\u00c6&#8221;, users would waste their time looking for an &#8220;\u00c6&#8221; key on their keyboard. Although English doesn&#8217;t have many ligatures any more, <a href=\"http:\/\/www.microsoft.com\/typography\/otfntdev\/devanot\/shaping.htm\"> many other languages<\/a> <a href=\"http:\/\/www.microsoft.com\/typography\/OpenType%20Dev\/arabic\/shaping.mspx\"> still employ them heavily<\/a>. (You may have noticed that the keytip was a bit overzealous with the ZWNJ, putting one at the end of the string even though there was nothing for the second F to be unjoined from!)<\/p>\n<p>So if you encounter one of these ZWNJ characters, don&#8217;t be afraid. He&#8217;s just there to break things up. And as Michael notes, ZWNJ and ZWJ &#8220;are supposed to be ignored in things like the Unicode Collation Algortihm.&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Preventing characters from combining.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-6093","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Preventing characters from combining.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/6093","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=6093"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/6093\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=6093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=6093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=6093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}