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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:49:22+00:00 2026-05-30T05:49:22+00:00

I’ve two questions: Is there a way through which we can open a xls

  • 0

I’ve two questions:

Is there a way through which we can open a xls file and save it as a tsv file through Java?
EDIT:
Or is there a way through which we can convert a xls file into an tsv file through Java?

Is there a way in which we can convert a UTF-16LE file to UTF-8 using java ?

Thank you

  • 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-30T05:49:24+00:00Added an answer on May 30, 2026 at 5:49 am

    I’ve two questions:

    On StackOverflow you should split that into two different questions…

    I’ll answer your second question:

    Is there a way in which we can convert a UTF-16LE file to UTF-8 using
    java?

    Yes of course. And there’s more than one way.

    Basically you want to read your input file specifying the input encoding (UTF-16LE) and then write the file specifying the output encoding (UTF-8).

    Say you have some UTF-16LE encoded file:

    ... $ file testInput.txt 
    testInput.txt: Little-endian UTF-16 Unicode character data
    

    You then basically could do something like this in Java (it’s just an example: you’ll want to fill in missing exception handling code, maybe not put a last newline at the end, maybe discard the BOM if any, etc.):

        FileInputStream fis = new FileInputStream(new File("/home/.../testInput.txt") );
        InputStreamReader isr = new InputStreamReader( fis, Charset.forName("UTF-16LE") );
        BufferedReader br = new BufferedReader( isr );
        FileOutputStream fos = new FileOutputStream(new File("/home/.../testOutput.txt"));
        OutputStreamWriter osw = new OutputStreamWriter( fos, Charset.forName("UTF-8") );
        BufferedWriter bw = new BufferedWriter( osw );
        String line = null;
        while ( (line = br.readLine()) != null ) {
            bw.write(line);
            bw.newLine();   // will add an unnecessary newline at the end of your file, fix this
        }
        bw.flush();
        // take care of closing the streams here etc.
    

    This shall create a UTF-8 encoded file.

    $ file testOutput.txt 
    testOutput.txt: UTF-8 Unicode (with BOM) text
    

    The BOM can clearly be seen using, for example, hexdump:

     $ hexdump testOutput.txt -C
    00000000  ef bb bf ... (snip)
    

    The BOM is encoded on three bytes in UTF-8 (ef bb fb) while it’s encoded on two bytes in UTF-16. In UTF16-LE the BOM looks like this:

    $ hexdump testInput.txt -C
    00000000  ff fe ... (snip)
    

    Note that UTF-8 encoded files may or may not (both are totally valid) have a “BOM” (byte order mask). A BOM in a UTF-8 file is not that silly: you don’t care about the byte order but it can help quickly identify a text file as being UTF-8 encoded. UTF-8 files with a BOM are fully legit according to the Unicode specs and hence readers unable to deal with UTF-8 files starting with a BOM are broken. Plain and simple.

    If for whatever reason you’re working with broken UTF-8 readers unable to cope with BOMs, then you may want to remove the BOM from the first String before writing it to disk.

    More infos on BOMs here:

    http://unicode.org/faq/utf_bom.html

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from
i want to parse a xhtml file and display in UITableView. what is the

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.