• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URL Encode

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Is there any option for specifying the encoding string in URL encode. I am using: file = URLEncoder.encode(file) then if file contains any spaces its being replaced with +. But I need spaces to be replaced with %20. Is there anyway to specify the encoding string in URLEncode ?

Thanks.
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, I too have a question regarding this..

In the query string, i know you cannot have space for parameters passed..

now coming to encoding url.. some use '+' for space and some use %20.
what is the difference ?? and which one is the preferred one???

I think google uses '+' , so i use '+'
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The '%' encoding can be used for any arbitrary character while + specifically repersents the space character.

I use whatever java.net.URLEncoder produces. Why would you do this 'by hand'?
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Jack Daniel",
You have changed your display name from one which was valid to one which is not. Accounts with invalid display names get deleted.

Please change it back immediately.

thanks,
Dave.
reply
    Bookmark Topic Watch Topic
  • New Topic