[ELI5] Why does Notepad display a wall of garbled text when opening a non-.txt file?

525 views

Every so often, if I open a non-text based document in either Microsoft Word or Notepad, it will open a massive file with an endless wall of completely garbled, gibberish text, most of the characters being either rectangle boxes or characters that can’t normally be typed. What does each of these characters represent? What happens if I insert or delete these characters?

Usually files would refuse to open with an incompatible format. How do these text-processing softwares somehow manage to run virtually any file?

In: 15

13 Answers

Anonymous 0 Comments

the text processing software isn’t necessarily running the file, its just showing you what’s inside.

what’s inside depends on what kind of file it is. for example a .exe file contains machine code instructions, a .zip file contains a bunch of separated chunks of data, and so on. every file on a computer can be whittled down to binary, so a text processor is able to open them all.

notepad/word sees the binary the files are made of & tries to output it the only way it knows how, which is to translate the sequences to text. but since these sequences aren’t human readable data in the first place, you get the gibberish text & characters. if you insert or delete any of these characters & save the file, that will most likely corrupt it & cause it to not be runnable by whatever software its meant for.

You are viewing 1 out of 13 answers, click here to view all answers.