05 December 2021

Sometimes files contains non visible character or UTF-8 character that are similar to ASCII.
In this post I show two ways that helped me.

Note: all example below could be execute in a container:

docker run -it  ubuntu /bin/bash
apt update && apt install -y vim

Via sed

  1. Create a file with not printable and ascii
    echo -e '\xe2\x98\xbc Hello\x07World!\xe2\x98\xba' > /tmp/file.txt
    
  2. Display non visible character via sed
    sed -n 'l' /tmp/file.txt
    

Via vi

  1. Create a file with not printable and ascii
    echo -e '\xe2\x98\xbc Hello\x07World!\xe2\x98\xba' > /tmp/file.txt
    
  2. Display non visible character via vi
    vi -b /tmp/file.txt