Skip to main content
  1. Notes/
  2. Vim/

Replace non-breaking space

Table of Contents

Replace non-breaking space
#

I imported the output of the tree command into a markdown file and was confronted with this:

Non breaking space
Non breaking space

I find the “~” character annoying and want to get rid of them.

Isolating the output I put it through od to get the codes.

0000000 302 240 302 240      \n
0000006

Some search later: The output 302 240 from od -c indicates that the character is encoded as two bytes: octal 302 and 240.

This is likely a non-breaking space (U+00A0) in UTF-8.

To replace this with actual spaces:


:%s/\%u00a0/ /g