Here is the first 8 bytes of a PNG file:
137 | 80 | 78 | 71 | 13 | 10 | 26 | 10 |
P | N | G | \r | \n | Ctrl-Z | \n |
Each byte has it's own usage:
137
This is a non-ASCII character to serve two purposes:
- Text editor will treat it as binary file
- To catch the error on FTP ASCII transfer types
Human readable file type
13 10 (\r \n)
To catch the the file is converted from Windows line encoding to Unix line encoding
26 (Ctrl-Z)
This is end-of-file marker to prevent dispalying lots of garbage characters if user "type" file in DOS
10
To catch the the file is converted from unix Line encoding to Windows line encoding
The PNG file header can detect common transfer errors and is readable if type the file in DOS terminal.