The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Important to defeat Twitter wrongly auto-guessing of URLs (and assuming anything with @ or # is a mention or hashtag) is Nelson’s Weblog: tech / zero-width-space

Posted by jpluimers on 2024/07/11

Quoting in full from [Wayback/Archive] Nelson’s Weblog: tech / zero-width-space to demonstrate a zero-width-space problem with WordPress too.

[Wayback/Archive] Zero width space

The zero width space is a useful Unicode character. It’s white space but renders with zero width. Useful for hinting where a line break could go if a browser needs to wrap a long line. It’s also good for faking out Twitter’s annoying URL rewriter; if you stick a ZWS in the middle of a domain name then Twitter won’t rewrite your text with a t.co redirect.

The zero width space is Unicode character [Wayback/Archive] U+200B. (HTML ​). It’s remarkably hard to type. [Wayback/Archive] On Windows you can type Alt8203. On Linux you apparently can type CtrlShiftU 8203. On a Mac you need [Wayback/ArchiveCharacter Viewer; search for “zero” and double click the invisible character on row 4, column 1 to insert a ZWS.

ZWS >​​< ZWS

Or you can just cut and paste it. I put one up there for you, between the left and right angle brackets. Of course being zero width you can’t easily select it; best bet is to copy the angle brackets too, all 3 characters. Then paste and delete the brackets. You can verify the ZWS is still there by using the arrow keys to move the cursor; it should get “stuck” on the ZWS and require two movements to pass.

When posting this in either the Gutenberg editor or classic editor, the zero-width space inside ZWS >​​< ZWS is gone which you can verify in WordPress itself by viewing the page as “Text” or in a web-browser by viewing the page source: there is no .

Since copying and representing zero-width-space is a pain in so many tools, below are some tips on automating things all via [Wayback/Archive] bookmarklet twitter zero width space – Recherche Google.

The show you both how hard it is on a normal system to access something simple as a Zero Width Space, and how easy it is to write a Bookmarklet in JavaScript.

It also made me find [Wayback/Archive] Stop Twitter from Adding Links in your Tweets – YouTube which directs to [Wayback/Archive] Prevent Twitter from Converting @Mentions into Links – Digital Inspiration which shows an HTML fragment that automatically copies the content of an input to a span automatically appending a Zero-Width Space after each dot (.), at (@) or hash (#) character. Should be easily converted to a HTML page that converts from a multi-line input to a multi-line output.

Query that led me to all this: [Wayback/Archive] zero width space – Google Search

–jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.