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

The Archive Base Latest Questions

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

I am developing a Java application where I am consuming a web service. The

  • 0

I am developing a Java application where I am consuming a web service. The web service is created using a SAP server, which encodes the data automatically in Unicode. I get a Unicode string from the web service.

”
倥䙄ㄭ㌮਍쿣ී㈊〠漠橢਍圯湩湁楳湅潣楤杮਍湥潤橢਍″‰扯൪㰊഼┊敄瑶灹⁥佐呓′†䘠湯⁴佃剕䕉⁒渠牯慭慌杮䔠ൎ⼊祔数⼠潆瑮਍匯扵祴数⼠祔数റ⼊慂敳潆瑮⼠潃牵敩൲⼊慎敭⼠う㄰਍䔯据摯湩⁧′‰൒㸊ാ攊摮扯൪㐊〠漠橢਍㰼਍䰯湥瑧⁨‵‰൒㸊ാ猊牴慥൭ 䘯〰‱⸱2
“

above is the response.

I want to convert it to readable text format like String. I am using core Java.

  • 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:16:13+00:00Added an answer on June 7, 2026 at 7:16 am

    If you have byte[] or an InputStream (both binary data) you can get a String or a Reader (both text) with:

    final String encoding = "UTF-8"; // "UTF16LE" or "UTF-16BE"
    
    byte[] b = ...;
    String s = new String(b, encoding);
    
    InputStream is = ...;
    BufferedReader reader = new BufferedReader(new InputStreamReader(is, encoding));
    for (;;) {
        String line = reader.readLine();
    }
    

    The reverse process uses:

    byte[] b = s.geBytes(encoding);
    OutputStream os = ...;
    
    BufferedWriter writer = new BufferedWriter(new OuputStreamWriter(os, encoding));
    writer.println(s);
    

    Unicode is a numbering system for all characters. The UTF variants implement Unicode as bytes.


    Your problem:

    In normal ways (web service), you would already have received a String. You could write that string to a file using the Writer above for instance. Either to check it yourself with a full Unicode font, or to pass the file on for a check.

    You need (?) to check, which UTF variant the text is in. For Asiatic scripts UTF-16 (little endian or big endian) are optimal. In XML it would be defined already.


    Addition:

    FileWriter writes to a file using the default encoding (from operating system on your machine). Instead use:

    new OutputStreamWriter(new FileOutputStream(new File("...")), "UTF-8")
    

    If it is a binary PDF, as @bobince said, use just a FileOutputStream on byte[] or InputStream.

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

Sidebar

Related Questions

I am developing a Java Application (not a web app, no server etc) using
I am developing a Java web application using Hibernate and JSF/primefaces. am sometimes getting
I am currently developing Java/GWT-application which is hosted on a weblogic application server. I
I'm developing a Java application which will act as a server for an information
I am developing smart device application. In that I am consuming the java web
I am developing a Java Web Application using JSF 2.0. Users can upload files.
I'm developing a java application which will run on LAN, i do test today
i'm developing a java application using the jstun library (hxxp://jstun.javawi.de/), and i need to
i'm developing a java application in which i have a JFrame with a JDesktopPane
I'm developing a Java application and I'm using the JUNG library. In my application

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.