Yes, that's it exactly and Adobe got it right.  The + is listed as a 
non-encoded character in the docs for encodeURI().  So what needs to 
be done is call encodeURIComponent() on the substring, which *will* 
encode the + since it isn't a non-encoded character for that 
function, and then tack that onto an encodeURI()'d string.

--- In flexcoders@yahoogroups.com, "Paul DeCoursey" <[EMAIL PROTECTED]> wrote:
>
> I think the problem is that the + should not be encoded. You must
> encode it before adding it to the URI.  It is a reserved character 
and
> it has special meaning in certain places in the URI.  It should not 
be
> encoded in those places.  As a result I am speculating that an 
encode
> function will not encode it.  An example of a special meaning is 
that
> it can be used in place of spaces in a URL, it is just as common to
> use %20 for a space, but a + is more readable.
> 
> Paul
> 
> --- In flexcoders@yahoogroups.com, "Doug Lowder" <douglowder@> 
wrote:
> >
> > How about encodeURIComponent("dude man+") ?  The + character, as 
well 
> > as some others, is a reserved character in URIs.
> > 
> > --- In flexcoders@yahoogroups.com, "Jesse Warden" <jesse.warden@> 
> > wrote:
> > >
> > > Weird... encodeURI does the same thing.  Check it:
> > > 
> > > var str:String = encodeURI("dude man+");
> > > 
> > > Notice that with encode or encodeURI, you'll get:
> > > 
> > > dude%20man+
> > > 
> > > ...bleh!  That dang + should be %2D instead.
> > > 
> > > BTW, for background context, I'm first base64'ing some XML, and 
then
> > > encoding it to send as a GET request param.  If you know of a 
better
> > > way, I'm all ears.
> > > 
> > > On 4/24/07, Jesse Warden <jesse.warden@> wrote:
> > > > Nope.  I'm using encode.
> > > >
> > > > On 4/24/07, Michael Wills <michael@> wrote:
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >  Are you using encodeURI? You may need to use 
> > encodeURIComponent instead.
> > > > > Just checking briefly on the JS versions.
> > > > >
> > > > >  Michael
> > > > >
> > > > >  Jesse Warden wrote:
> > > > >
> > > > >
> > > > >
> > > > > Running encode on a String seems to be missing the +. For 
> > example, a
> > > > >  space " " becomes %20 like expected. But, a + is not 
becoming %
> > 2D...
> > > > >  anyone know why?
> > > > >
> > > > >
> > > > >  
> > > >
> > >
> >
>


Reply via email to