Search code examples
windowsvimnotepad

How to get Vim to correctly display file instead of showing ^@ characters


I have a file which shows different things in Notepad and Vim.

The file displays normally under Windows Notepad:

picture of file in Windows Notepad

Strange character are added to each character when using Vim.

picture of file in Vim

Anyone know how to dismiss those strange character in Vim under Windows environment?


Solution

  • As you can see: TSS is displayed as T^@S^@S^@(binary: 54 00 53 00 53 00).
    Because vim shows \0x00 as ^@. It sounds like UTF16LE.


    You can convert UTF16LE to UTF8:

    :e ++enc=UTF16LE
    :set fenc=UTF8
    :w