• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JavaScript/java equivalent function?

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ravi Mandalapu
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
reply
    Bookmark Topic Watch Topic
  • New Topic