3

I have a file in my C: drive on Windows named MSDELog.log and from opening the file with a hex editor I can see that there is a null character after each character. But there is no indicator at the start of the file saying unicode or whatever the encoding is.

If I open this file with the Windows notepad it seems to recognise it and opens correctly.

If I open the file in emacs I see the text but every other character is ^@ - I realise this indicates a null character.

If I hit m-x revert-buffer-with-coding-system and try utf-8 there is no change in the view. If I select utf-16 then I see a load of what looks like Chinese characters.

How do I view this file in emacs?

4

It's a file encoded in utf-16 little endian format without the byte order mark. You have to specify the endianness selecting utf-16-le when you use revert-buffer-with-coding-system

| improve this answer | |
  • I wondered what le meant – arcomber Nov 21 at 17:45

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.