This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Eclipse Collections Categorically: Level up your programming game and have Donald Raab on-line!
See this thread for details.
  • 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I am not JavaScript expert. What exactly does the escape() do? If you mean an escape character, that is the \ in Java. So \" forces a literal double quote.
If you are just trying to work with hex in java then prefacing the hex value with 0x makes it hex.
0x12 = 18 dec
 
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 Cindy,
Thank you very much for your response.
My problem is, I have to invoke the NetscapeMessenger at client side and i have to pass the form data to Netscape messenger fields like CC,TO,BODY,.... for this reason i used MAILTO:// approach.
Suppose if i pass multible lines to Messenger body field,it is displaying total data in single line, suppose if we use javascript escape() function, it will convert newlinecharacters,spaces,.....into hex code and pass that data to Messenger.
I want the same functionality using java,is it possible?
Thankx in advanch.
Reply will be greatly appreciate.
ravi

Originally posted by Cindy Glass:
Well I am not JavaScript expert. What exactly does the escape() do? If you mean an escape character, that is the \ in Java. So \" forces a literal double quote.
If you are just trying to work with hex in java then prefacing the hex value with 0x makes it hex.
0x12 = 18 dec


 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's a class in java.net
URLEncoder.encode( myString );
That will do the same thing as escape in javascript
 
All that thinking. Doesn't it hurt? What do you think about this tiny ad?
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic