[jcifs] Re: SMB URL encoding/decoding

Michael B Allen mballen at erols.com
Sun Feb 24 16:37:31 EST 2002

On Sat, 23 Feb 2002 22:54:14 -0600
"Christopher R. Hertel" <crh at ubiqx.org> wrote:

> Michael B Allen wrote:
> > 
> > On Sat, 23 Feb 2002 22:27:59 -0600
> > "Christopher R. Hertel" <crh at ubiqx.org> wrote:
> > 
> > > A note... I looked all through the RFC and found nothing about
> > > translating the '+' into a space.  Annoying, as I know it was there
> > > in the early days.
> > 
> > Oh, great. So there's a difference between the MIME x-www-form-urlencoded
> > format and http URL encoding. Looks like just the '+' is different
> > though.
> MIME may decode the "+" at the MIME level, before it becomes visible as a
> URL string...  I'm just guessing.  I don't have a lot to go on, just that
> I looked through and found examples in the RFC where a space was
> translated to %20 but no mention of "+" being used.

Actually it's important that we do not use Java's URLDecoder then. Since
we have to run all paths through a decoder routine any '+' would have
to be escaped if we used java.net.URLDecoder. We should provide our
own decode() that' *does not* decode '+'. If of course a user uses '+'
they will get File not found or create files with '+' but that would be
user error because a) they shouldn't be enoding path components b) it's
not defined by the spec and c) they should use the jCIFS provided
decode(). I wonder why Java didn't stop encoding the '+'. I guess if
they decode it they have to encode it too and either way they start to
ruin backwards compatability.


May The Source be with you.

More information about the jcifs mailing list