[ACCEPTED]-What is the difference between plaintext and binary data?-plaintext

Accepted answer
Score: 12

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

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

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

Score: 7

"Plaintext" can have several meanings.

The 33 one most useful in this context is that 32 it is merely a binary files which is organized 31 in byte sequences that a particular computers 30 system can translate into a finite set of 29 what it considers "text" characters.

A second 28 meaning, somewhat connected, is a restriction 27 that said system should display these "text 26 characters" as symbols readable by a human 25 as members of a recognizable alphabet. Often, the 24 unwritten implication is that the translation 23 mechanism is ASCII.

A third, even more restrictive 22 meaning, is that this system must be a "simple" text 21 editor/viewer. Usually implying ASCII encoding. But, really, there 20 is VERY little difference between you, the 19 human, reading text encoded in some funky 18 format and displayed by a proprietary program, vs. VI 17 text editor reading ASCII encoded file.

Within programming context, your 16 programming environment (comprized by OS 15 + system APIs + your language capabilities) defines 14 both a set of "text" characters, and a set 13 of encodings it is able to read to convert 12 to these "text" characters. Please note 11 that this may not necessarily imply ASCII, English, or 10 8 bits - as an example, Perl can natively 9 read and use the full Unicode set of "characters".

To 8 answer your specific question, you can definitely 7 use "character" strings to transmit arbitrary 6 byte sequences, with the caveat that string 5 termination conventions must apply. The 4 problem is that the functions that already 3 exist to "process character data" would 2 probably not have any useful functionality 1 to deal with your binary data.

Score: 5

One thing it often means is that the language 13 might feel free to interpret certian control 12 characters, such as the values 10 or 13, as 11 logical line terminators. In other words, an 10 output operation might automagicly append 9 these characters at the end, and an input 8 operation might strip them from the input 7 (and/or terminate reading there).

In contrast, language 6 I/O operations that advertise working on 5 "binary" data will usually include an input 4 parameter for the length of data to operate 3 on, since there is no other way (short of 2 reading past end of file) to know when it 1 is done.

Score: 4

Generally, it depends on the language/environment/functionality.

Binary 3 data is always that: binary. It is transferred 2 without modification.

"Plain text" mode may 1 mean one or more of the following things:

  • the stream of bytes is split into lines. The line delimiters are \r, \n, or \r\n, or \n\r. Sometimes it is OS-dependent (like *nix likes \n, while windows likes \r\n). The line ending may be adjusted for the reading application
  • character encoding may be adjusted. The environment might detect and/or convert the source encoding into the encoding the application expects
  • probably some other conversions should be added to this list, but I can't think of any more at this moment
Score: 3

Technically nothing. Plain text is a form 10 of binary data. However a major difference 9 is how values are stored. Think of how an 8 integer might be stored. In binary data 7 it would use a two's complement format, probably 6 taking 32 bits of space. In text format 5 a number would be stored instead as a series 4 of unicode digits. So the number 50 would 3 be stored as 0x32 (padded to take up 32 2 bits) in binary but would be stored as '5' '0' in 1 plain text.

More Related questions