IntelliJ Java IDE
The moose likes HTML, CSS and JavaScript and the fly likes URL encoded data breaking Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "URL encoded data breaking" Watch "URL encoded data breaking" New topic
Author

URL encoded data breaking

Tripp Bishop
Greenhorn

Joined: Aug 23, 2002
Posts: 21
Howdy all,
I've got an MD5 hash that I URL encode and put in a querystring. When the + character is in the hash I escape it with %2B. This seems to work fine except sometimes the browser will change it back to a + character. Then, the URL decoding turns it into a space and things break. Other times the browser (IE and Mozilla) will leave it alone (as %2B). Anyone know a fix for this???
Thanks
Tripp
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
Not sure where your problem is happening with the encoding with your question
did you look into these: encodeURI, decodeURI, encodeURIComponent, and decodeURIComponent.
Tripp Bishop
Greenhorn

Joined: Aug 23, 2002
Posts: 21
It's the browsers that are causing the problem. When the string is generated the format is correct. A lot of the time the links work. Other times I can see the data in the location bar change to the nonsafe format, then the operation fails. It's kinda odd. Not something that fails everytime.
-- T
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
Are we talking IE here??
 
 
subject: URL encoded data breaking
 
Threads others viewed
java [question -- difference between java and c]
Java x C/C++ performance comparasion
Incoming Parameter Value Encoding Problem
Regarding ActionContext.getContext().getParameters(); is struts2
encodeURI how does it suppose to work
IntelliJ Java IDE