Hi, Is there any equivalent javascript's escape() function in java? I want to hex-encode in java, that's why i need that function. Any help would be greatly appeciate. Thankx, Ravi
Cynthia Yao
Ranch Hand
Joined: Nov 06, 2000
Posts: 92
posted
0
please check the api looking for java.net.URLEncoder. The class contains a utility method for converting a String into a MIME format called "x-www-form-urlencoded" format.
Ravi Mandalapu
Ranch Hand
Joined: Nov 01, 2000
Posts: 34
posted
0
HI Cynthia Yao, Thank you very much for your response. yes, u are right, but the problem is it is replacing spaces with "+". In result i am displaying + symbols.... If you have any suggessions, please let me know... Thank you. Ravi
spalaniv
Greenhorn
Joined: May 08, 2001
Posts: 5
posted
0
Yes, Cynthia is right. public class URLEncoder extends Object The class contains a utility method for converting a String into a MIME format called "x-www-form-urlencoded" format. To convert a String, each character is examined in turn: The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same. The space character ' ' is converted into a plus sign '+'. All other characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the lower 8-bits of the character.
Sakthi
Ravi Mandalapu
Ranch Hand
Joined: Nov 01, 2000
Posts: 34
posted
0
HI spalaniv, Thank you very much for your response. My problem is I am devoloping Mailing system.(Using mailto://) In body we will get result with + marks.. I don't want to see like that. Just i want to see like spaces instead of + marks.. Is there any other solution for that? I will be greatly appreciate for your response. ravi
Yes, Cynthia is right. public class URLEncoder extends Object The class contains a utility method for converting a String into a MIME format called "x-www-form-urlencoded" format. To convert a String, each character is examined in turn: The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same. The space character ' ' is converted into a plus sign '+'. All other characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the lower 8-bits of the character.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.