Hex C2A0 is UTF8 for non-breaking space

Dealing with text files from many sources, it’s not uncommon to get stray hex codes in the files. These characters may be UTF8 or some other character mapping. They may be invisible or show up as empty squares or other odd glyphs. We had numerous markdown files for this website that had been converted from a legacy blogging system. We observed in certain files invisible characters with hex code C2A0. This is UTF8 for non-breaking space.

Programmatically remove the C2A0 in-place with SED like:

sed -i 's/\xC2\xA0/ /g' myfile.txt