Solved

Jakarta POI - Java API To Access Microsoft Format Files

Posted on 2004-08-26
5
269 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Yes the file I took was not using the right encoding.

Thank u girionis
0
 
LVL 35

Expert Comment

by:girionis
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now