----- Original Message -----
From: "Paul Brown" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 11, 2002 2:00 AM
Subject: RE: Bas64 encoding performance
[snip]
> But I also I grabbed the wrong snippet of code; this was the one that I
> wanted:
>
> + } else if (sixBit == 66) {
> + throw new Error("bad character \'" + c + "\' in base64 value");
>
> This one should let the character go (p. 25):
>
> if (sixBit == 66) byteShift--;
Paul,
a better way to allow any character is just to remove the state 66. That
is to say change all the translateTable entries from \u0042 to \u0041 and to
change:
sixBit = (c < translateTable.length) ? translateTable[c] : 66;
to
sixBit = (c < translateTable.length) ? translateTable[c] : 65;
then the } else... can be removed.
However, I do not favour this change. I believe that the RFC allows a Base64
processor to reject messages containing non Table 1 characters and
whitespace. I believe that an XML-RPC Base64 processor should reject such
messages.
John Wilson
The Wilson Partnership
http://www.wilson.co.uk