I have a pair of "Unicode little endian without BOM" text files that I would like to diff each other via the command line. Unfortunately when I open them using the command line in vim for Windows they come up as a bunch of unreadable binary symbols because the encoding WinMerge is expecting is wrong.

Is there any way to feed these into vim in a readable format?


Vim's name for that encoding is ucs-2le (ucs-2 for Unicode, 2 byte per character, le for little endian). You can open that via

:edit ++enc=ucs-2le filename

enforcing the encoding, or alternatively (if you open such files often), add that encoding to the list of detected ones:

:set fileencodings^=ucs-2le

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.