commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julius Davies (JIRA)" <j...@apache.org>
Subject [jira] Created: (CODEC-75) Base64 URL-SAFE
Date Sat, 23 May 2009 18:53:45 GMT
Base64 URL-SAFE
---------------

                 Key: CODEC-75
                 URL: https://issues.apache.org/jira/browse/CODEC-75
             Project: Commons Codec
          Issue Type: Improvement
            Reporter: Julius Davies
             Fix For: 1.4


Regular Base64 uses + and / for code point 62 and 63.  URL-Safe Base64 uses - and _ instead.
 Also, URL-Safe base64 omits the == padding to help preserve space.

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

Approach:

decode() should be able to seamlessly handle either situation.  This means interpreting +-
and /_ as equivalents at any time during the decode.  decode() also needs to be more robust
against missing padding characters.

encode() should either emit +/ or -_ depending on a mode set during Base64 construction.

Since URL-SAFE is all about URL's (e.g. HTTP GET) and most browsers are limited to 1KB of
query string, I do not think we need to bother making the URL-MODE available in the stream-oriented
classes.  (Nonetheless, the streams should be able to decode URL-SAFE, but I don't think they
should produce it).

---

Some background information:  I'm putting together a webapp that integrates with MS Active
Directory.  Users and Groups are keyed of objectGUID with is a 128 bit int.  Would be nice
to get some support for this kind of thing:

"Click to view the profile of <a href='?u=_3-PwBzbRxqMi1qTBhg_6A'>Julius Davies</a>."


Right now I'm using Hex:

"Click to view the profile of <a href='?u=ff7f8fc01cdb471a8c8b5a9306183fe8'>Julius Davies</a>."


Current Base64 class would output this, and I suspect the + would screw things up:

"Click to view the profile of <a href='?u=/3+PwBzbRxqMi1qTBhg/6A=='>Julius Davies</a>."



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message