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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:57:53+00:00 2026-06-16T09:57:53+00:00

I’m using Apache HttpClient v4.2.2 to try and hit a URL, and am getting

  • 0

I’m using Apache HttpClient v4.2.2 to try and hit a URL, and am getting a URISyntaxException that I can’t seem to figure out:

try {
    String uri = "http://a.example.com/12/allrigh/bouncer?my_key1=i[(Gz$xrCcCeaCrHv}[5Ryou4kz@Yh~c@K_if-p7vGQ3ZF[fEpm2SmH(Z6Yh40Ea";

    HttpClient httpClient = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(uri);
    HttpResponse response = httpClient.execute(httpGet);
} catch(Throwable throwable) {
    // Log & handle
}

Exception in thread "main" java.lang.IllegalArgumentException
    at java.net.URI.create(URI.java:859)
    at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)
    ...
Caused by: java.net.URISyntaxException: Illegal character in query at index 65: http://a.example.com/12/allrigh/bouncer?my_key1=i[(Gz$xrCcCeaCrHv}[5Ryou4kz@Yh~c@K_if-p7vGQ3ZF[fEpm2SmH(Z6Yh40Ea
    at java.net.URI$Parser.fail(URI.java:2825)
    at java.net.URI$Parser.checkChars(URI.java:2998)
    at java.net.URI$Parser.parseHierarchical(URI.java:3088)
    at java.net.URI$Parser.parse(URI.java:3030)
    at java.net.URI.<init>(URI.java:595)
    at java.net.URI.create(URI.java:857)
    ... 6 more

As far as I can tell, the 65th character is an “H“…so what’s going on here?!? In addition to figuring out what’s wrong with my URI, the next obvious question is: what can I do to fix this? Do I need to base-64 encode the URI? If so, how? Thanks 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-06-16T09:57:54+00:00Added an answer on June 16, 2026 at 9:57 am

    I don’t quite understand how characters are counted and where index 65 is. But the invalid characters in your URL are the curly braces (see https://stackoverflow.com/a/7109208/413337).

    Why does your URL look like this? Where are these curly braces coming from?

    You cannot Base64 encode the query parameter unless the server expects them that way. Furthermore, the query parameters already look as if they are Base64 encoded. But the regular character set for Base64 encoding is not URL-safe.

    URL encoding the query parameters might help. See URLEncoder.encode(String, String).

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but

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.