Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy do we use Base64?
    text
    copied!<p><a href="http://en.wikipedia.org/wiki/Base64" rel="noreferrer">Wikipedia</a> says</p> <blockquote> <p>Base64 encoding schemes are commonly used when there is a need to encode binary data that needs be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remains intact without modification during transport.</p> </blockquote> <p>But is it not that data is always stored/transmitted in binary because the memory that our machines have store binary and it just depends how you interpret it? So, whether you encode the bit pattern <code>010011010110000101101110</code> as <code>Man</code> in ASCII or as <code>TWFu</code> in Base64, you are eventually going to store the same bit pattern.</p> <p><strong>If the ultimate encoding is in terms of zeros and ones and every machine and media can deal with them, how does it matter if the data is represented as ASCII or Base64?</strong></p> <p>What does it mean "media that are designed to deal with textual data"? They can deal with binary => they can deal with anything.</p> <hr> <p>Thanks everyone, I think I understand now.</p> <p>When we send over data, we cannot be sure that the data would be interpreted in the same format as we intended it to be. So, we send over data coded in some format (like Base64) that both parties understand. That way even if sender and receiver interpret same things differently, but because they agree on the coded format, the data will not get interpreted wrongly.</p> <p>From <a href="https://stackoverflow.com/questions/3538021/why-do-we-use-base64/3538079#3538079">Mark Byers example</a></p> <p>If I want to send </p> <pre><code>Hello world! </code></pre> <p>One way is to send it in ASCII like </p> <pre><code>72 101 108 108 111 10 119 111 114 108 100 33 </code></pre> <p>But byte 10 might not be interpreted correctly as a newline at the other end. So, we use a subset of ASCII to encode it like this</p> <pre><code>83 71 86 115 98 71 56 115 67 110 100 118 99 109 120 107 73 61 61 </code></pre> <p>which at the cost of more data transferred for the same amount of information ensures that the receiver can decode the data in the intended way, even if the receiver happens to have different interpretations for the rest of the character set.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload