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. But is it often used string to string (as in 
#base64Encoded and #base64Decoded, which are still implemented using 
Base64MimeConverter) but the explicit correct way is as in ZnUtils 
#encodeBase64: and #decodeBase64: using a character encoding.

On 09 Mar 2014, at 09:09, Pharo4Stef <[email protected]> wrote:

> around Zinc-Character-Encoding-Core
> :)
> 
> Stef
> On 09 Mar 2014, at 09:07, Pharo4Stef <[email protected]> wrote:
> 
>> I’m sure that we have that. I remember sven’s code using encoder 
>> but I do not know where.
>> 
>> # Method for encoding ints with base64 encoding
>> def encode(n):
>>      data = struct.pack("i", n)
>>      s = base64.b64encode(data)
>>      return s
>> 
> 


Reply via email to