Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4567942
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:00:15+00:00 2026-05-21T19:00:15+00:00

I m trying to match java base64 code in php. But getting inconsistent result.

  • 0

I m trying to match java base64 code in php. But getting inconsistent result.

Java base64 encode

encMessage = URLEncoder.encode(new Base64(-1).encodeToString(encrypted),"UTF8");

Java decode

message = URLDecoder.decode(message,"utf8");

Above code java encode code return the string which i have to decode and decrypt in php

PHP base64 decode

$message     = utf8_decode(urldecode($encrypted));
$message     = base64_decode($message);

PHP encode

$encMessage     = base64_encode($encrypted);
$encMessage     = utf8_encode(urlencode($encMessage));

Results:
java:

KO%2F%2B%2Bzbp5z8oCdvZn62jb72kseT%2Bem8hYUZY0IuB9zo%3D 

php:

KO%2F%2B%2Bzbp5z8oCdvZn62jb3CVVVXsV%2Bws2kDOmKK%2BPEc%3D

src : https://gist.github.com/944269

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:00:17+00:00Added an answer on May 21, 2026 at 7:00 pm

    I had this problem between CSharp and Java, and found that URL encoding things was the culprit. What I did in my work around was basically re-encrypt the data with a newly generated public key until I got one that didn’t need URL encoding. Not a great solution, but it works, it averages 2 tries to get it right, but I’ve seen it taking up to 15 tries to do it, either way we’re still talking milliseconds, and it works reliably.

    YMMV

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to use Java's regexp I want to match /app, /app/.* , but not
I'm trying to build a Java regular expression to match .jar! The catch is
I'm trying to come up with a Java regex that will match a filename
I am trying to match multiple CSS style code blocks in a HTML document.
I'd trying to style my ComboBoxes to match the rest of the UI but
I m trying to match unicode characters in Java. Input String: informa String to
I'm trying to match the following using a regular expression in Java - I
I am trying to write a pattern in Java to match against Java import
I'm trying to match chunks of JS code and extract string literals that contain
I am trying to match a multi line text using Java. When I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.