Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

delete U+200B zero-width space characters using sublime text 3

How can I make U+200B character or delete them in using sublime text 3. I found http://pastebin.com/ehWxNfMe but I am not sure how to use it

like image 745
thealbinosmurf Avatar asked Dec 03 '13 16:12

thealbinosmurf


People also ask

How do you write a zero width space character?

On Windows you can type Alt-8203. On Linux you apparently can type Ctrl-Shift-U 8203. On a Mac you need Character Viewer; search for "zero" and double click the invisible character on row 4, column 1 to insert a ZWS.

How do I uninstall 200b?

Find: Hold Alt and press 0 1 2 9 (this will input a zero-width character). Replace: Leave empty.

What is a zero width space character?

The zero-width space (​), abbreviated ZWSP, is a non-printing character used in computerized typesetting to indicate word boundaries to text-processing systems in scripts that do not use explicit spacing, or after characters (such as the slash) that are not followed by a visible space but after which there may ...


1 Answers

The easiest way to delete zero width spaces in Sublime Text is using the search and replace functionality:

  • Press Ctrl + h ( Alt + Cmd + f for Mac )
  • Enable the Regular expression flag by clicking the leftmost button on the search panel or pressing Alt + r ( Alt + Cmd + r for Mac )
  • Enter \x{200b} as the search term
  • Make sure the "Replace with" field is empty and hit "Replace All"

Plugins for solving this problem for good!

I searched for a plugin that would highlight all the possibly code breaking characters but couldn't find one for Sublime Text so I wrote one: https://github.com/TuureKaunisto/highlight-dodgy-chars

The plugin works on a whitelist principle: all non-ascii characters that are not whitelisted in the settings get highlighted.

If you want to highlight things based on your own regular expression, this plugin will do the trick: https://github.com/bluegray/Highlighter and is also easily installable via Package Manager.

like image 67
Tuure Avatar answered Oct 09 '22 09:10

Tuure