[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Jakarta POI - Java API To Access Microsoft Format Files

Posted on 2004-08-26
5
Medium Priority
?
283 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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month17 days, 18 hours left to enroll

829 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