aspose file tools*
The moose likes Servlets and the fly likes JavaScript/java equivalent function? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JavaScript/java equivalent function?" Watch "JavaScript/java equivalent function?" New topic
Author

JavaScript/java equivalent function?

Ravi Mandalapu
Ranch Hand

Joined: Nov 01, 2000
Posts: 34
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
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
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
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
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://aspose.com/file-tools
 
subject: JavaScript/java equivalent function?
 
Similar Threads
what's the command equivalent to getch()
Dropping leading zeros on numeric field
JavaScript/Java Equivalent function?
Clrscr() Equivalent function Java
in java where is clrscr() function