Base64?
Hilaire Fernandes
hilaire at ext.cri74.org
Sat Oct 30 07:56:31 UTC 2004
I have found the following to be working:
decode := Base64MimeConverter mimeDecodeToChars:
(ReadStream on: ((result valueNamed: 'image') asString)).
Then using (decode contents) to access to the image contents
Hilaire Fernandes a écrit :
> Hello,
>
> I try to figure out how to use the Base64MimeConverter class to encode
> binary (image content from a WAFile instance) to base64 format, so I can
> safely upload it into a MySQL BLOB.
>
> However when I encode with:
>
> encode := Base64MimeConverter mimeEncode:
> (ReadStream on: ((aFile contents) asString)).
>
>
> I can save it in a BLOB without problem.
>
>
> However the oposit operation is not working:
>
> decode := Base64MimeConverter mimeDecodeToBytes:
> (ReadStream on: (result valueNamed: 'image')).
>
> I got the following error:
>
> MessageNotUnderstood: SmallInteger>>asciiValue
>
> from the Base64MimeConverter>>nextValue method.
>
> It looks like it is expecting a char but it gots a SmallInteger.
>
> Does it come from the initial conversion?
> Or should I convert the initial content a Stream of char? How?
>
> Thanks
>
> Hilaire
>
>
>
More information about the Squeak-dev
mailing list
|