← Back to team overview

maria-developers team mailing list archive

Re: Review of base64.diff and german2.diff

 

Hi Monty,


On 09/23/2013 07:16 PM, Michael Widenius wrote:

Hi!

"Alexander" == Alexander Barkov <bar@xxxxxxxxxxx> writes:

<cut>

Should we allow not '=' padding in our decoder too?
(I think it's best to always pad on encoding).

<cut>

Alexander> Just checked PostgreSQL. They also pad on encode,
Alexander> and do not accept non-properly padded values on decode:

<cut>

How about all the programs that don't padd with '='?
There was a list of these in the wiki link you gave me ...

It was a list of various variants of base64 that have existed through the time:

http://en.wikipedia.org/wiki/Base64

I believe the modern base64 is associated with:
- Char for index 62 = "+"
- Char for index 63 = "-"
- Pad character = "mandatory"

Look at the table. All variants that have "+" and "-"
for "Char for index 62" and "Char for index 63"
have also "Pad character = mandatory".

The only exception is:
"Modified Base64 encoding for UTF-7 (RFC 1642, obsoleted)".
But it's obsoleted long time ago!


For those who wants the ancient modified Base64 for UTF-7,
there is a simple workaround:

mysql> set @a:='aa';
mysql> select from_base64(rpad(@a,cast(length(@a)/4 as signed)*4,'='));

+----------------------------------------------------------+
| from_base64(rpad(@a,cast(length(@a)/4 as signed)*4,'=')) |
+----------------------------------------------------------+
| i                                                        |
+----------------------------------------------------------+
1 row in set (0.00 sec)




Regards,
Monty



Follow ups

References