A long time ago I remember opening an executable file (.exe) in a text editor, and saving it back to the hard drive. The executable, needless to say, didn't open.
My understanding is that a file is a series of bytes. In the case of a text file, these bytes encode letters. In the case of an executable file, these bytes encode instructions.
Both text files and executable files are simply a series of bytes, and my understanding is that those bytes are only given meaning by how you interpret them. The character 'a' could be a letter in the word apple, or one byte in a legitimate program coding for some low level operation. Likewise, all the instructions of the program can be interpreted as gibberish characters in the context of being a text document.
So my question then is why, since I haven't changed anything in the file before saving it, it would no longer work as a program. Shouldn't the series of bytes be the exact same?
What specifically changes about this file when I use a text editor which causes it to no longer execute even though the filename and contents are the same?