Link to home
Start Free TrialLog in
Avatar of pouli
pouli

asked on

Jakarta POI - Java API To Access Microsoft Format Files

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
Avatar of pouli
pouli

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pouli

ASKER

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
Avatar of pouli

ASKER

Yes the file I took was not using the right encoding.

Thank u girionis
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.