Reputation: 26958
I have a file which shows different things in Notepad and Vim.
The file displays normally under Windows Notepad:
Strange character are added to each character when using Vim.
Anyone know how to dismiss those strange character in Vim under Windows environment?
Upvotes: 3
Views: 1637
Reputation: 161604
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
Upvotes: 6
Reputation: 700152
The file is stored as UTF-16, where each character is represented by two bytes. VIM opens it as if it was an ASCII or UTF-8 file, so each pair of bytes is turned into two characters.
Notepad recognises the encoding, but apparently VIM doesn't. Specify the encoding when you open the file.
Upvotes: 1
Reputation: 4996
That looks like unicode. You can open the file in notepad and save it as ascii.
Alternatively, if you don't want to create a new file, you can change your vimrc settings to enable multi-byte character encoding.
Here's more information from the vim wiki:
http://vim.wikia.com/wiki/Working_with_Unicode
Upvotes: 1