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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:12:30+00:00 2026-06-07T07:12:30+00:00

As title say … I read content from htto response InputStream is = response.getEntity().getContent();

  • 0

As title say …
I read content from htto response

 

    InputStream is = response.getEntity().getContent();
    String cw = IOUtils.toString(is);
    byte[] b = cw.getBytes("Cp1250");
    String x = StringUtils.newStringUtf8(b);
    String content = new String(b, "UTF-8");

    System.out.println(content);

 

I have tried plenty of variations. I am little confused about what are correct encoding constants used as strings. windows-1250 or Cp1250. UTF-8 or utf-8 or utf8?

  • 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-07T07:12:32+00:00Added an answer on June 7, 2026 at 7:12 am

    You seem to think that a String object has an encoding. That’s not correct. An encoding is used as part of the translation from binary data (a byte[] or InputStream) to text data (a String or char[] etc).

    It’s not clear what IOUtils.toString is doing, but it’s almost certainly losing data or at least handling it inappropriately. If your data is originally in Windows-1250, then you should use an InputStreamReader wrapping the InputStream, specifying the charset in the InputStreamReader constructor call.

    It’s not clear where UTF-8 comes in – you might want to write out the data in UTF-8 afterwards, but the result of that would be byte[], not a string.

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

Sidebar

Related Questions

Let's say I have two simple models project t.string :title vote t.references :project t.integer
Say there are two arrays: String[] title = { One,Two,three,Four}; String[] user = {
lets say the string is <title>xyz</title> I want to extract the xyz out of
Say this is my sql: SELECT title, author, ISBN FROM bs_books ORDER BY ISBN
Lets say I want to query for string this is first title and I
As the title say is it possible and how? I have found a .Find
Well, the title say it all. I have a ruby script I want running
I know the title didnt say much, but here I go with a clearer
Let say I have something like this: id | title | 1 | First
Well I say what's said in the title again, I can't find a way

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.