• 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

modified Base 64 encoding for URL in Java

Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I know Jakarta commons has a Base 64 encoding. But it does not supports a
'modified Base64 for URL'. Can you please tell me if there is any Java library which supports the base 64 encoding for URL?

From here:

For this reason, a modified Base64 for URL variant exists, where no
padding '=' will be used, and the '+' and '/' characters of standard
Base64 are respectively replaced by '*' and '-', so that using URL
encoders/decoders is no longer necessary and has no impact on the
length of the encoded value, leaving the same encoded form intact for
use in relational databases, web forms, and object identifiers in gen

Thank you.

Posts: 27451
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't seen one myself, but I have to say that the reason given in that Wikipedia article for the existence of that modified encoding doesn't apply in the Java world. It doesn't matter that text strings being put into databases might contain '%' characters because using a PreparedStatement eliminates the possibility of the sort of problem mentioned in the article.

So I don't think you actually need that algorithm if you're working in Java.
    Bookmark Topic Watch Topic
  • New Topic