Laurie:

FYI, I got a response from someone on comp.lang.java.programmer.
They suggested using the java.net.URI class.
I tried it and it works perfectly.

Thanks,
        Neil


--
Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com
FREE! Valuable info on how your business can reduce operating costs by
17% or more in 6 months or less! http://newsletter.JAMMConsulting.com

> -----Original Message-----
> From: Neil Aggarwal [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 26, 2005 9:38 PM
> To: 'Struts Users Mailing List'
> Subject: RE: [OT] Force URLEncoder to use %20 instead of + for spaces
> 
> 
> Laurie:
> 
> Did you try these two URLs I put in my email?
> 
> Why does this fail:
> http://dev.rentclubs.com/~maryanne/images/clubs/Driver/Ping+G2
> +Driver.gif
> 
> and this one work:
> http://dev.rentclubs.com/~maryanne/images/clubs/Driver/Ping%20
> G2%20Driver.gi
> f
> 
> Any ideas?
> 
> Thanks,
>       Neil
> 
> --
> Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com
> FREE! Valuable info on how your business can reduce operating costs by
> 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com
> 
> > -----Original Message-----
> > From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
> > Sent: Tuesday, July 26, 2005 5:12 PM
> > To: user@struts.apache.org
> > Subject: Re: [OT] Force URLEncoder to use %20 instead of + 
> for spaces
> > 
> > 
> > Neil Aggarwal wrote:
> > > Hello:
> > > 
> > > When I encode the name of an image file to place into a 
> > URL, I use this
> > > code:
> > > 
> > > URLEncoder.encode(imageName,"UTF-8")
> > > 
> > > This gives me image names with spaces replaced by + signs 
> > which IE does not
> > > like. 
> > > 
> > > If I change the spaces to %20, the URL works perfectly in IE.
> > > 
> > > For example, if my image name is Ping G2 Driver.gif, 
> > URLEncoder gives me
> > > this URL:
> > >  
> > <http://dev.rentclubs.com/~maryanne/images/clubs/Driver/Ping+G
> > 2+Driver.gif>
> > > 
> > http://dev.rentclubs.com/~maryanne/images/clubs/Driver/Ping+G2
> +Driver.gif
> > 
> > If I try to load this URL in IE, it gives me a 404 error.
> > 
> > If I use the exact same url with %20, it works just fine:
> >  
> >
> <http://dev.rentclubs.com/~maryanne/images/clubs/Driver/Ping%2
> 0G2%20Driver.g
> > if>
> >
> http://dev.rentclubs.com/~maryanne/images/clubs/Driver/Ping%20
> G2%20Driver.gi
> > f
> > 
> > I thought + and %20 were both acceptable for spaces in a URL, but
> apparently
> > IE does not like the plus signs.  
> >  
> > Is there a way to force URLEncoder to use %20 instead of + signs?
> 
> Nope. '+' is canonical and should work fine. What encoding 
> are you sending 
> your pages with? That's the only thing I can think of that 
> might make a 
> difference.
> 
> L.
> -- 
> Laurie, Open Source advocate, Java geek and novice blogger:
> http://www.holoweb.net/laurie
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to