• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLEncoder

 
Randall Twede
Ranch Hand
Posts: 4489
3
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