• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URL Encode

 
ford Darcy Jr
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • 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.
 
Jack Daniel
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • 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 '+'
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65128
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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'?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic