Solved

Jakarta POI - Java API To Access Microsoft Format Files

Posted on 2004-08-26
5
272 Views
Last Modified: 2010-03-31
Hello, experts

I have a problem could you please help me ?

It is my first time I am using the POI to access Microsoft excel files and I am facing the problem of Unicode one more time.

My excel files have Unicode characters.
When I parse the files with the POI the characters are becoming '?'
It seems that it does not read the files as UTF-8

I cannot believe that they haven't  thought about that the people that made this.

I htought of opening the source code and try to find out where is the Reader to set it by hand, but it must be another easier way

Anybody can help ????

Thank you in advance
0
Comment
Question by:pouli
  • 3
  • 2
5 Comments
 

Author Comment

by:pouli
ID: 11901677
Here is a small part of code that sets the encoding

                              while( cells.hasNext() ) {
                                    HSSFCell cell = (HSSFCell) cells.next();
                                    
                                    //System.out.println(cell.getEncoding());
                                    cell.setEncoding( HSSFCell.ENCODING_UTF_16 );

I does not work though
0
 
LVL 35

Accepted Solution

by:
girionis earned 125 total points
ID: 11901746
Where do you display the data and you see ???. It might be that you read the data correctly but the display screen does not support unicode. Can you write to a file and see if you still have problems?
0
 

Author Comment

by:pouli
ID: 11901785
I am writing the contents to files.

But you have just gave me the idea that I the program that someone else gave me might not write to the right encoding.

I am checking it now.

Give me a sec
0
 

Author Comment

by:pouli
ID: 11902014
Yes the file I took was not using the right encoding.

Thank u girionis
0
 
LVL 35

Expert Comment

by:girionis
ID: 11903897
Thank you for accepting :)

As a tip, Java is by default unicode so it should work on most cases. DOS prompt and some shell of *nix implementaiton do not support unicode so you might be seeing ??? instead of characters. It is always good to write the data to a file and open them with an editor that supports unicode encoding.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question