commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: [fileupload] towards 1.3 release - feedbacks required
Date Wed, 20 Mar 2013 08:26:00 GMT
priceless!!!

> At present it treats an embedded PAD as the end of input (as per
> Codec) but maybe it would be better to only allow 1 or 2 PADs at the
> end?

IMHO having such behaviour is acceptable, but if it doesn't cost you
too much, having the behaviour described in Wikipedia[1] is a 'nice to
have':

+-----------------------------------------------------------+
Decoding Base64 with padding
When decoding Base64 text, 4 characters are typically converted back
to 3 bytes. The only exceptions are when padding characters exist. A
single '=' indicates that the 4 characters will decode to only 2
bytes, while 2 '='s indicates that the 4 characters will decode to
only a single byte. This example illustrates:
Encoded text ends with: YW55IGNhcm5hbCBwbGVhcw==   Block with 2 '='s
decodes to 1 character:  any carnal pleas
Encoded text ends with: YW55IGNhcm5hbCBwbGVhc3U=   Block with 1 '='
decodes to 2 characters:  any carnal pleasu
Encoded text ends with: YW55IGNhcm5hbCBwbGVhc3Vy   Block with 0 '='s
decodes to 3 characters: any carnal pleasur
+-----------------------------------------------------------+

Thanks!
-Simo

[1] http://en.wikipedia.org/wiki/Base64

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message