I have pasted some text in my document with ZERO-WIDTH-SPACEs (ZWSP, U+200B) in it, and I'd like to remove them. However, I can't seem to paste it into the Word Find and Replace box and there doesn't seem to be a special character listed for that Unicode character. How can I find and remove all instances of this character?
4 Answers
If you run charmap, you should be able to find the character you are trying to input.
You can then copy it and paste into Word's search box.
This will work for other obscure characters when you can't find and highlight an instance of the character in the text so as to copy from there and paste into the search box.
2Zero-width spaces (U+200B) are referred to in Word's Find (but not Replace) as ^u8203, which is easier than getting it from CharMap (though for Replace I know no other way).
Actually, zero-width spaces inserted by Word 2003 and 2007 Insert Symbol are U+200C (^u8204 in Find), not U+200B. In Windows XP (where I use Word 2003), CharMap can't even find U+200B. Windows 7 CharMap describes U+200B as "Zero Width Space" and U+200C as "Zero Width Non-Joiner". Word 2007 uses the latter, same as 2003. Both characters seem to do the job.
This article has some more info: How to make URLs wordwrap in Word.
If not working in MS Word copy a part of the text that contains the ZWS and reveal code in MS Word. Find the position of the character. Say it is the last character. Copy the complete word; then start deleting the rest of the characters but do not just press the backspace of delete for any length of time but keep deleting each character. The ZWS should not be deleted. MS word, or Excel can thus be used for finding and replacing the ZWS.
On a Mac, MS Word (version 16.54) has some behavior that can be confusing. Once you get the hang of it, it's pretty manageable.
- Either a "zero width space" or a "zero width non-joiner" will allow an optional line break in the document.
- You can enter either of these by using the "Emoji & Symbols" palette from macOS. If you open that via Edit > Emoji & Symbols, you may then need to click on the command-key icon in the upper right corner to expand the dialog. Then you can search for 200b to find the zero width space or 200c to find the zero width non-joiner. Double-click on the (invisible) character in the "Character code" section and macOS will type it into your document.
- You can also use the Emoji and Symbols palette to enter either of these into the find/replace dialog
- You can also (usually) copy and paste these symbols from the document into the find/replace dialog (you probably need to use the "show paragraph marks" button to see them).
- If you copy and paste a zero width non-joiner from the document into the find/replace dialog, you get a zero width non-joiner followed by a normal space, which you will probably want to delete. The zero width space doesn't have this problem.
- If you copy and paste these symbols from a URL in the document into the find/replace dialog, they get stripped out. (This tripped me up and made me think it was impossible to put them into the dialog at all. But actually they copy and paste from plain text just fine.)
- If you have one of these in the find/replace dialog, it will not be visible, but the cursor will need one extra press of the arrow key to move past it. e.g., if you have x[zero width space]y, if you use the right-arrow key to move the cursor past x, then you will have to press the right-arrow key again to move past the zero width space (no visible movement), then again to move past the y. This is a good way to check that you really have one in the dialog box.