Fix Base64 madness for good

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Fix Base64 madness for good

Sven Van Caekenberghe-2
Hi,

I propose the following:

https://pharo.manuscript.com/f/cases/21870/Fix-Base64-madness-for-good
https://github.com/pharo-project/pharo/pull/1331

This is a much needed cleanup, IMHO. It is a breaking change however, since it changes the signature (return type) of an existing method.

#base64Decoded used to wrongly return a String, while that should be a ByteArray since Base64 encoding is a way to encode bytes as ASCII text, hence decoding it should give you back the original bytes.

Sven
Reply | Threaded
Open this post in threaded view
|

Re: Fix Base64 madness for good

Esteban A. Maringolo
10/05/2018 16:42, Sven Van Caekenberghe wrote:

> Hi,
>
> I propose the following:
>
> https://pharo.manuscript.com/f/cases/21870/Fix-Base64-madness-for-good
> https://github.com/pharo-project/pharo/pull/1331
>
> This is a much needed cleanup, IMHO. It is a breaking change however, since it changes the signature (return type) of an existing method.
>
> #base64Decoded used to wrongly return a String, while that should be a ByteArray since Base64 encoding is a way to encode bytes as ASCII text, hence decoding it should give you back the original bytes.

Those who were using these methods expecting a string can send #asString
to the returned bytarray. Of course that would be wrong, but it would be
"as wrong as before", and hence, compatible.

So please go ahead and change it. Also, having a "proper" implementation
in a live environment serves a teaching vehicle for those learning how
stuff works.

Regards,

--
Esteban A. Maringolo

Reply | Threaded
Open this post in threaded view
|

Re: Fix Base64 madness for good

NorbertHartl
In reply to this post by Sven Van Caekenberghe-2


> Am 10.05.2018 um 21:42 schrieb Sven Van Caekenberghe <[hidden email]>:
>
> Hi,
>
> I propose the following:
>
> https://pharo.manuscript.com/f/cases/21870/Fix-Base64-madness-for-good
> https://github.com/pharo-project/pharo/pull/1331
>
> This is a much needed cleanup, IMHO. It is a breaking change however, since it changes the signature (return type) of an existing method.
>
> #base64Decoded used to wrongly return a String, while that should be a ByteArray since Base64 encoding is a way to encode bytes as ASCII text, hence decoding it should give you back the original bytes.
>
Please do. It is obviously the right move. The times where strings contained bytes and it makes sense is over for a long time.

Norbert

Reply | Threaded
Open this post in threaded view
|

Re: Fix Base64 madness for good

Guillermo Polito
YESS!

On Thu, May 10, 2018 at 10:33 PM, Norbert Hartl <[hidden email]> wrote:


> Am 10.05.2018 um 21:42 schrieb Sven Van Caekenberghe <[hidden email]>:
>
> Hi,
>
> I propose the following:
>
> https://pharo.manuscript.com/f/cases/21870/Fix-Base64-madness-for-good
> https://github.com/pharo-project/pharo/pull/1331
>
> This is a much needed cleanup, IMHO. It is a breaking change however, since it changes the signature (return type) of an existing method.
>
> #base64Decoded used to wrongly return a String, while that should be a ByteArray since Base64 encoding is a way to encode bytes as ASCII text, hence decoding it should give you back the original bytes.
>
Please do. It is obviously the right move. The times where strings contained bytes and it makes sense is over for a long time.

Norbert




--

   

Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - http://www.cnrs.fr


Web: http://guillep.github.io

Phone: +33 06 52 70 66 13