thanks for the discussion. Stef On 10 Mar 2014, at 13:22, Henrik Johansen <henrik.s.johansen@veloxit.no> wrote:
On 09 Mar 2014, at 9:50 , Sven Van Caekenberghe <sven@stfx.eu> wrote:
ZnBase64Encoder new encode: 42 asByteArray. => 'Kg=='
(ZnBase64Encoder new decode: 'Kg==') asInteger. => 42
There is also #asByteArrayOfSize: and signed/unsigned might come into play as well.
Note that strictly speaking (as implemented by ZnBase64Encoder), Base64 is a binary to string encoding.
"String" is such a loose concept, binary -> safe ASCII subset, really. Since Stefâs motivation was understanding (which in my mind always includes *why* something is done), the implication of that, is that you can safely transmit the data over any medium, with no fear of any intermediary transaction participant misinterpreting the data.
The cost of this is a 33% overhead (3 binary bytes -> 4 encoded bytes), which isnât all that bad compared to alternatives like using the hex printstring. (Which, by the way, was fairly recently added as the ânewâ standard binary format in postgres, Iâd love to see the discussion where THAT ended up as the preferred alternative⦠http://www.postgresql.org/docs/9.1/static/datatype-binary.html)
Cheers, Henry