Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between plaintext and binary data?

Many languages have functions which only process "plaintext", not binary. Does this mean that only characters within the ASCII range will be allowed?

Binary is just a series of bytes, isn't it similar to plaintext which is just a series of bytes interpreted as characters? So, can plaintext store the same data formats / protocols as binary?

like image 409
Robin Rodricks Avatar asked Sep 16 '09 19:09

Robin Rodricks


People also ask

What is the difference between text and binary modes?

When we try to read or write files in our program, usually there are two modes to use. Text mode, usually by default, and binary mode. Obviously, in text mode, the program writes data to file as text characters, and in binary mode, the program writes data to files as 0/1 bits.

What is the difference between text and binary file in Python?

The major difference between these two is that a text file contains textual information in the form of alphabets, digits and special characters or symbols. On the other hand, a binary file contains bytes or a compiled version of a text file.

What is the difference between binary file and text file in Java?

The two file types may look the same on the surface, but their internal structures are different. While both binary and text files contain data stored as a series of (bits (binary values of 1s and 0s), the bits in text files represent characters, while the bits in binary files represent custom data.

Is binary more efficient than text?

Text protocols are better in terms of readability, ease of reimplementing, and ease of debugging. Binary protocols are more compact. However, you can compress your text using a library like LZO or Zlib, and this is almost as compact as binary (with very little performance hit for compression/decompression.)


1 Answers

a plain text is human readable, a binary file is usually unreadable by a human, since it's composed of printable and non-printable characters.

Try to open a jpeg file with a text editor (e.g. notepad or vim) and you'll understand what I mean.

A binary file is usually constructed in a way that optimizes speed, since no parsing is needed. A plain text file is editable by hand, a binary file not.

like image 75
Federico klez Culloca Avatar answered Oct 04 '22 15:10

Federico klez Culloca