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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:31:50+00:00 2026-06-12T23:31:50+00:00

we are using the external service to get the data in a CSV format.

  • 0

we are using the external service to get the data in a CSV format. we are trying to write the data to response so that the csv can be downloadable to client. unfortunately, we are getting the data in the below format.

Amount inc. VAT      Balance
£112.83             £0.0
£97.55              £0.0
£15.28              £0.0

we are unable to decode the content. Is there a way to decode £ and display £ in java.

Is there any String Utils available to decode the strings.

  • 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-12T23:31:51+00:00Added an answer on June 12, 2026 at 11:31 pm

    Problem:
    when we use the getBytes() over string, it tries to decode using the default encoder. once the String is encoded, decoding may not work well if we use the default decoders.

    Solution: One
    StringUtils of apache will help us in decoding these characters while writing back to the response.
    This class is available in org.apache.commons.codec.binary package.

    String CSVContent = "/* CSV data */";
    /**
     *  Decode the bytes using UTF8.  
     */
    String decodedStr = StringUtils.newStringUtf8(CSVContent.getBytes("UTF-8"));
    /**
     *  Convert the decoded string to Byte array to write to the stream  
     */
    Byte [] content = StringUtils.getBytesIso8859_1(decodedStr);
    

    Maven 2.0 dependency.

    <dependency>
         <groupId>commons-codec</groupId>
         <artifactId>commons-codec</artifactId>
         <version>1.6</version>
    </dependency>
    

    Solution: Two

    As per @Joni, Better solution with the standard API:

    content = CSVContent.getBytes("ISO-8859-1");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I plan on using JSONP to call an external web service to get around
I am designing the API for a client of a service that retrieves data
I'm using an external token service to validate my users and they then get
I'm trying to integrate my rails application with an external service. I'm using Cucumber
I'm using Dojo toolkit to get data from an external JSON source (a web
I am trying to clear images using external jquery file but it's not showing
In my application I'm using an external library (Batik 1.7) that is made up
I know that I can display time for a particular location using only JavaScript
My app queries a service using an external library in the form of a
I have an application that talks to several internal and external sources using SOAP,

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.