• 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

avoiding '#' '+' '%'

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
In my application i am encrypting message using javax.crypto. and sending it through request. it is working fine but problem is whenever thereis an occurence of any one of these symbols '+' '#' '%' in the encrypted message
request.getParameter skipps that symbol and making problem on decryption.
please suggest any method to avoid these symbols.I tried with utf8 and ascii encoding with base64 encoder both give '+' symbols on encryption.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should be URL-encoding all parameters, encrypted or not.
 
Manoj John
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Bibeault


But can i make sure that the encoding will remove these unsafe and reserved characters by this code
-------------code--------
URLEncoder.encode("toEncode","UTF8")
--------------------------------
and Decode with
------------------------------------
URLDecoder.decode("toDecode","UTF8")
----------------------------------------
or to use any other like ASCII like something..
am i in right way?
[ July 30, 2004: Message edited by: Manoj John ]
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep,

import java.net.URLEncoder;

and...

URLEncoder.encode("Your Encrypted String", "UTF-8");

and that's it.


Mike Cronin
[ August 01, 2004: Message edited by: Mike Cronin ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic