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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:52:14+00:00 2026-05-27T11:52:14+00:00

I am writing a small app that retrieves some html from a web server

  • 0

I am writing a small app that retrieves some html from a web server based on some variables in the http POST. The HTML data that comes back has a <pre> section in it with some words that are spaced out nicely using newline and tab characters but my app does not receive them. The code is as follows

HttpPost post = new HttpPost("REMOVED FOR PRIVACY");

    try {
        // Add your data
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
            //REMOVED FOR PRIVACY

        post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        // Execute HTTP Post Request
        HttpResponse response = httpClient.execute(post, httpContext);
        String htmlBrief = inputStreamToString(response.getEntity().getContent()).toString();
        return htmlBrief;
        }

I think it might be how I am reading the response by putting it through a BufferedReader like so

private StringBuilder inputStreamToString(InputStream is) throws IOException {
    int c;
    StringBuilder total = new StringBuilder();

    // Wrap a BufferedReader around the InputStream
    BufferedReader rd = new BufferedReader(new InputStreamReader(is));

    // Read response until the endIndex
    while ((c = rd.read()) != -1) { 
        total.append((char)c); 
    }

    // Return full string
    return total;
}

I thought it might be because I was reading in line by line in the buffered reader so I switched to one character at a time but it didn’t help the problem.

Any help would be greatly appreciated.

Thanks, Ben

  • 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-27T11:52:15+00:00Added an answer on May 27, 2026 at 11:52 am

    Use Charles or Fiddler to inspect what is actually sent in the HTTP request body.

    Most likely problems:

    • Mismatching character sets for client & server;
    • Failure to decode the URL encoded body.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing small VB.Net app which should build reports based on data gathered from
I'm writing a small app in qt that is to access some data in
I'm writing a small app that reads some input and do something based on
I'm writing a small GUI app that contains some editor functionality, and something that
I've been writing a small app that basically loads its content from locally stored
I'm currently writing a small app that takes data provided by an SQL stored
I'm in the process of writing a small web app that would allow me
I am writing a small app that has to perform some 'sanity checks' before
I'm writing a small Django app that displays a few simple values from an
I'm writing a small app to do a little processing on some cells in

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.