Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

URLEncoder  RSS feed

 
Randall Twede
Ranch Hand
Posts: 4637
7
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is URLEncoder being used here?
String servletGET = webServerStr + "?"
+ URLEncoder.encode("UserOption") + "="
+ URLEncoder.encode("AppletDisplay");
The API says these two strings will remain unchanged.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably a developer who uses URLEncoder as a matter of principle. The only advantage I can think of is that another developer changing these strings at some later date cannot forget to use URLEncoder if/when necessary.
- Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!