Base64?

Hilaire Fernandes hilaire at ext.cri74.org
Fri Oct 29 20:36:14 UTC 2004


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