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 3802628
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:14:17+00:00 2026-05-19T14:14:17+00:00

In Java, I need to use HTTP Post to send request to server, but

  • 0

In Java, I need to use HTTP Post to send request to server, but if in the parameter of the URL contains some special character it throws below Exception

java.lang.IllegalArgumentException:
URLDecoder: Illegal hex characters in
escape (%) pattern – For input string:
“&'”

The code to send data

DefaultHttpClient httpclient = new DefaultHttpClient(); 
   HttpPost httpPost = new HttpPost(URL); 

   String sessionId = RequestUtil.getRequest().getSession().getId();
   String data = arg.getData().toString();

   List<NameValuePair> params = new ArrayList<NameValuePair>();   
   params.add(new BasicNameValuePair(param1, data));
   params.add(new BasicNameValuePair(param2, sessionId));
         httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));           

   HttpResponse response = (HttpResponse) httpclient.execute(httpPost);

And at the server side, i use the below code to read information

 String data = request.getParameter(param1);
   if (data != null) {
    actionArg = new ChannelArg(URLDecoder.decode(data, "UTF-8"));
   }

The code works correctly but if i input some special character like [aああ#$%&'(<>?/.,あああああ], it will throw exception. I wonder if someone could help me some hint to be able to encode and decode special characters?

Thank you very much in advance.

  • 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-19T14:14:18+00:00Added an answer on May 19, 2026 at 2:14 pm

    Sadly url encoder will not solve your problem. I had this problem and used a custom utility. I remember this I got from googling ;).

    http://www.javapractices.com/topic/TopicAction.do?Id=96

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

Sidebar

Related Questions

I need my program to send a request to a server. The problem is,
For debugging purposes, I need to configure Java to use a proxy for HTTP
I need some direction how to best use Exceptions in a Java EE environment,
I need a byte buffer class in Java for single-threaded use. I should be
I have a java application I need to pass some info to a C++
I'm creating some big files (DB exports) with Java and I need to put
Using C# & Java Script I have the link like this http://localhost/Server/Vehicle/Vehicle.aspx?appid=5 , when
I need to send a HTTPPost with body gzipped, the server accepts non gzipped
i'm working with SOA using WebServices. So i need to send a XML request
I need to use Wordnet in a java-based app. I want to: search synsets

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.