[Implemented] Flag for Base64Encoder / Decoder...
Posted: Mon Oct 18, 2010 10:30 am
Could an optional flag be added to specify variants on the Base64 encoding and decoding (see wikipedia for variants):
"Using standard Base64 in URL requires encoding of '+' and '/' characters into special percent-encoded hexadecimal sequences ('+' = '%2B' and '/' = '%2F'), which makes the string unnecessarily longer.
For this reason, a modified Base64 for URL variant exists, where no padding '=' will be used, and the '+' and '/' characters of standard Base64 are respectively replaced by '-' and '_', so that using URL encoders/decoders are no longer necessary and have no impact on the length of the encoded value, leaving the same encoded form intact for use in relational databases, web forms, and object identifiers in general."
(with a new hybrid that (as well as changing the + and / over) changes the ending '=' into a '|' so it can easily be used in any url string - some urls use '=' in parameter exchange - I'm suprised the left it in with the 'official' variant).
"Using standard Base64 in URL requires encoding of '+' and '/' characters into special percent-encoded hexadecimal sequences ('+' = '%2B' and '/' = '%2F'), which makes the string unnecessarily longer.
For this reason, a modified Base64 for URL variant exists, where no padding '=' will be used, and the '+' and '/' characters of standard Base64 are respectively replaced by '-' and '_', so that using URL encoders/decoders are no longer necessary and have no impact on the length of the encoded value, leaving the same encoded form intact for use in relational databases, web forms, and object identifiers in general."
(with a new hybrid that (as well as changing the + and / over) changes the ending '=' into a '|' so it can easily be used in any url string - some urls use '=' in parameter exchange - I'm suprised the left it in with the 'official' variant).