2
When I open up a binary file in Vim, it displays a bunch of gibberish. One would expect it to display a bunch of 1s and 0s. Why is this?
2
When I open up a binary file in Vim, it displays a bunch of gibberish. One would expect it to display a bunch of 1s and 0s. Why is this?
4
Excellent question.
Text editors don't open files and show binary. They typically read files with ASCII or Unicode encoding.
Here's some examples of how ASCII encoding works:
Basically the way it works is, it reads the first number of bytes, and then interprets that collection of bits as a certain character, which is what you're seeing on your screen.
However, if you want to show binary (or hex) in Vim, you can, by doing something like this:
2One does not simply Vim into Binary. – Snesticle – 2012-11-07T22:27:29.623
2If you are using UNIX you can use the
hd
or hexdump command to dump out the the file in HEX and printable characters. – HeatfanJohn – 2012-11-07T22:29:01.693