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

  • Home
  • SEARCH
  • 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 7778651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:27:08+00:00 2026-06-01T18:27:08+00:00

I have a String String a=123+>jo I want to en code the String so

  • 0

I have a String String a="123+>jo I want to en
code the String so that I can redirect it to an url. I initially tried it with urlencoder but in urldecoder +(plus) is removed while decoding.So i lost my data.

What is the right way to encode so that I get the same string while decoding also?

  • 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-06-01T18:27:09+00:00Added an answer on June 1, 2026 at 6:27 pm

    URLEncoder works perfectly. The plus sign is succesfully encoded into %2B.

    Encoding: Works

    Here is the IDEONE project:
    http://ideone.com/zMDur

    import java.net.URLEncoder;
    
    // ...
    
        public static void main (String[] args) throws java.lang.Exception
        {
                String str = "123+>jo";
                String str2 = "http://1.com/23+>jo";
                System.out.println(URLEncoder.encode(str));
                System.out.println(URLEncoder.encode(str2));
        }
    

    prints:

    123%2B%3Ejo
    http%3A%2F%2F1.com%2F23%2B%3Ejo
    

    Encoding + Decoding: Works

    The IDEONE project with decoding as well: http://ideone.com/Ypfv4

    import java.net.URLEncoder;
    import java.net.URLDecoder;
    
    // ...
    
        public static void main (String[] args) throws java.lang.Exception
        {
                String str = "123+>jo";
                String str2 = "http://1.com/23+>jo";
                System.out.println(URLDecoder.decode(URLEncoder.encode(str)));
                System.out.println(URLDecoder.decode(URLEncoder.encode(str2)));
        }
    

    Prints:

    123+>jo
    http://1.com/23+>jo
    

    So everything works using the java.net.URLEncoder and java.net.URLDecoder.

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

Sidebar

Related Questions

for example. If I have the decimal 123.4567 I want the string 123.4567 but
I have this code: newArray = new String[][]{{Me,123},{You,321},{He,221}}; And I want to do this
I have a string, say '123' , and I want to convert it to
I have a list of string like: s = [(abc,bcd,cde),(123,3r4,32f)] Now I want to
Assume we have a string like the following : ,34,23,4,5,634,23,12,5,4,3,1234,23,54,,,,,,,123,43,2,3,4,5,3424,,,,,,,,123,,,1234,,,,,,,45,,,56 How can we convert
I have string that I want to chop to array of substrings of given
I want to copy F:\test to folder F:\123 so that I have folder F:\123\test.
I have a problem that I want to append a string into StringBuffer object
I have a line of code on the server that I want to move
Let's say I have a string : {id:123,xCoord:01.234567,yCoord:89.012345,etc.:etcetc} I want to extract only the

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.