Search code examples
asciivisual-studio-codenon-printing-characters

How to show ascii non-printable characters in Visual Studio Code?


I'm using Visual Studio Code version 1.51.1 and am wondering if there is any way to display all of the ascii non-printable characters when looking at a file. I used to use Notepad++ and it had a feature you could turn on that would show every character in a file including non-printable characters.

For example, here's a screenshot from a file open in Notepad++ that I've inserted the non-printable BEL character in by pressing ALT + 007. You can also see the carriage-return/line feeds at the end of the line:

enter image description here

Here's a list of the characters I'm referring to (I found this list here):

enter image description here

So what I'm asking is there an extension I can install into Visual Studio Code or a setting that I can configure that will show all ascii characters, both printable and non-printable, similar to how Notepad++ does it as shown in the screenshot I provided? Thanks in advance.


Solution

  • On the bottom-right corner of the status bar, you will see the encoding of the file. Click and select “Reopen with Encoding…” and change to something like UTF-8 or higher.

    You can also search for the “Change File Encoding” task via Cmd+Shift+P.