poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Birendar Waldiya" <bwald...@cisco.com>
Subject RE: Major Problem With POI Excel reader: Urgent Help Needed
Date Tue, 09 May 2006 09:39:18 GMT
Hi Tahir , 
First of all I thank you a lot for so much of support and pointer you have given to me , 
The problem is I think not of database driver , which you will unserstand from the flow of
data from first point to last point I am attaching in the doc. 
There is somthing with POI, 
becasue I happen to get the samed data entered into database once  using both text and xls
upload  it happned when 
 
I used  in my text parser 
 
 csvReader_ = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
 
instead of 
 
//csvReader_ = new BufferedReader(new InputStreamReader(new FileInputStream(filename),"ISO-8859-1"));
  
  In this case the data entered into database was same for both  xls parser and  text parser
 
Thanks 
Regrads 
Birendar S Waldiya 
 

     

  _____  

From: Tahir Akhtar [mailto:tahir@spectrum-tech.com] 
Sent: Tuesday, May 09, 2006 2:28 PM
To: 'Birendar Waldiya'
Subject: RE: Major Problem With POI Excel reader: Urgent Help Needed



Birendar,

This now proves that your problem is not related to POI in anyway. You application successfully
gets the data from POI in Java’s default encoding i-e UTF-16. 

 

Perhaps your database driver is expecting a different encoding by default. You will have to
check documentation of database and the driver you are using to see whether and how it supports
the required encoding. I feel that most modern databases and drivers will have no problem
in handling your characters if configured correctly.  Is your text based application is using
the same database and drivers? Is anything different in the way connection/statements are
created etc.

 

You must now focus on the database and database connectivity to resolve your problem.

 

Regards,

Tahir Akhtar

 

  _____  

From: Birendar Waldiya [mailto:bwaldiya@cisco.com] 
Sent: Monday, May 08, 2006 5:56 PM
To: 'Tahir Akhtar'; poi-user@jakarta.apache.org
Subject: RE: Major Problem With POI Excel reader: Urgent Help Needed

 

Hi Tahir, 

My eclipse is running on WINDOWS  and the webserver i am using is  TOMACT on local ,  where
in the  unix mean that my WebSpeher server which is running on UNIX platfrom , 

 

I did simple thing now : removed all my customed encoding : with my xls parser 

 

DID  System.out of the queries generated , on my Eclipse they are correctly generated and
when i copy it into  my text file still remain ok,

 

Manually copying and executing :

1. I executed the query in my  UTF-8 database where the data get inserted as  "¿¿¿¿" 


 

2. I executed this query inot my database which is  NOT UTF-8   the data is inserted correctly."ŠšŽž"

 

By Application :

1.  in my  UTF-8 database where the data get inserted as  "¿¿¿¿"  

2.  In my the data  inserted by  my applications executes by self  inserts it " `a}~"

 

thanks 

regrads 

Birendar S Waldiya 

 

 

 

  _____  

From: Tahir Akhtar [mailto:tahir@spectrum-tech.com] 
Sent: Monday, May 08, 2006 5:25 PM
To: 'Birendar Waldiya'; poi-user@jakarta.apache.org
Subject: RE: Major Problem With POI Excel reader: Urgent Help Needed

Hi Birendar,

You are getting it correct on eclipse console but not unix console. Are you running eclipse
on unix or windows? By unix console do you mean that your web-app-server running on unix server.
 What happens if you directly put data on database from eclipse i-e run the app direct from
eclipse without deploying to wep-app-server etc. 

 

I recommend: remove all custom handling of encoding and comparing the eclipse and unix output.
If you are getting something different on both instances then you have almost nabbed the problem.

 

P.S Java handles all the string internally as UTF-16 so I think JDBC drivers would expect
the same encoding by default. They would translate as necessary for target database. Also
note that it is quiet possible that the particular encoding supported by your db does not
support the characters in question.

 

Regards,

Tahir

 

 

  _____  

From: Birendar Waldiya [mailto:bwaldiya@cisco.com] 
Sent: Monday, May 08, 2006 4:34 PM
To: 'Tahir Akhtar'; poi-user@jakarta.apache.org
Subject: RE: Major Problem With POI Excel reader: Urgent Help Needed

 

Hi Tahir, 

I have done all the activities , the character on my eclipse console are printed as such,
however in unix console they look differ for xls uplaod. 

 

The "cell.setEncoding(HSSFCell.ENCODING_COMPRESSED_UNICODE); "  one i did as a last resort
though i knew this is not right to do it  here. still in a  *HOPE* if it works 

From the code you might have seen that I have tried to chage the encoding to ISO-8859-1 ,
UTF-8 extra etc etc

Let  me tell you what all I have done 

 

1. First I tried to simply read the string cell as its avaliable into a string  then try using
String.getBytes("encoding")  -values tries are  "ISO-8859-1,ISO-8859-10,ISO-8859-13,UTF-8
"  - this didnt worked .

2. Then I tried to chage the encodign of the xls file while saving : as  western (ISO) , then
tried to save it as "UNICODE", then I tried to save it as "UTF-8"  it didnt worked 

 

3. Then I tried to change the NLS_LANG parameter it didnt worked ,

 

4. Then I tried to insert this data in a different  databse that is UTF-8 ,  with String.getByets("UTF-8")
 this case works ..  but my databse is right now not set to UTF-8 

 

5. Finally I tried   cell.setEncoding(HSSFCell.ENCODING_COMPRESSED_UNICODE);  cell.setEncoding(HSSFCell.ENCODING_UTF_16);
   this dosnt works 

 

The greatest problem  is with text uplaod it working fine for thease mentioned character ,
which let me puzzled a lot .

 

BTW can you please  send the URL fro downloading poi jar ?

 

If any one in forun had ever faced this problem please guide me .

 

Thanks 

Regards 

Birendar S Waldiya

 

  _____  

From: Tahir Akhtar [mailto:tahir@spectrum-tech.com] 
Sent: Monday, May 08, 2006 4:36 PM
To: 'Birendar Waldiya'; poi-user@jakarta.apache.org
Subject: RE: Major Problem With POI Excel reader: Urgent Help Needed

Hi Birendar,

As I told you before, I do not have any experience of using exotic character sets. Here are
my best guesses however:

1.	You should *not* be setting encoding when reading a file. Setting encoding will be the
task of the application that created the file (in your case MS Excel). So remove following
line from your code:
cell.setEncoding(HSSFCell.ENCODING_COMPRESSED_UNICODE); 

2.	Print on console cell.getEncoding(). It would come 0 or 1.  I think you should get 1 here.


3.	Try printing the character on console right after you have read it from HSSFCell. What
do you get at this point? For a comparison print hard coded characters Š, š, Ž, ž  

 

Looking at the archives, I would guess that encoding of source excel file would be set depending
on the default encoding on the system where file was created. 

 

I hope someone with more experience with encoding and poi would be able to give you better
pointers

 

Regards,

Tahir

 

  _____  

From: Birendar Waldiya [mailto:bwaldiya@cisco.com] 
Sent: Monday, May 08, 2006 2:56 PM
To: tahir@spectrum-tech.com; poi-user@jakarta.apache.org
Subject: Major Problem With POI Excel reader: Urgent Help Needed

 

Hi Tahir, 

 

Thank you for your response in regards to the problem I have posted to forum, 

 

The details of probelms are as foollow : I am trying to read data from -

 

1. Text File : Using a text file parser that reads data from FileStreamReader 

2. XLS file :  This reads the data from InputStream loade to the POIFSFileSystem

 

When using text uplaod : this workign very fine and no problem with the characetr mentioned
 Š, š, Ž, ž  they  go file and look fine in database, 

But when I am using the xls uplaod  the aboce characters  does not get dispaled correctly.


I have tried to chage the cell encoding , tried to chage the string by  String.getBytes("encoding")
, tried to save xls file as UNICODE, UTF-8, Defualt ISO and all short of  things i can thing
but thease characetr doent get reflected into datase correctly.

 What can be done for getting charcters correctly?, My FRD is full of mention of thease charactrer
 they are not at all bother abot other characetr  and they will test onlt tease characetr
. 

 Attaching the code that reads data from xls file 

Your help and guidance will be of great use for me 

Thanks a lot agian , leaset you replied .

 

regards 

Birendar S Waldiya

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Birendar,

I think you would have to share some more information, perhaps a code
snippet if you expect any help from the forum. Try to explain your problem
in more detail.

Latest "release" of poi can be downloaded from poi website which is 2.5.1.
You can also get the latest development version from the dev directory. Both
release and development versions are available in source and binary forms.

Your problems seems to be related to handling of encoding. But I do not have
anything to say about it :). 


Regards,
Tahir Akhtar
-----Original Message-----
From: birendar.waldiya@tcs.com [mailto:birendar.waldiya@tcs.com] 
Sent: Friday, May 05, 2006 3:10 PM
To: POI Users List
Subject: Major Problem With POI Excel reader: Urgent Help Needed

Hi ,
I am using POI API for reading data from an excel file , which is advance
version of the API that read data from text file, to increase the character
bandwidth ie to support special charater . However the POI api are not
reading  special character properly. On unix they behave differently and on
windows they behave dirrerently.
However my text file parser is supporting more special character them my
excel reader.
I am facing problem with the character "Š, š, Ž, ž" whcih are read well and
inserted into databse well. But in  poi apis it fail to read them properly.
On windows they are read different them unix.

If any one has ever face such problem please help me, I have posting my
probwelm to this forum frequently for last few days but this seems to be
dead forum.
Can anyone tell me from where exactly I can get the POI jar latest  and
what is the lates version of it ?
The site is so old .

Please help
Thanks
Regards
Birenadr S Waldiya
=====-----=====-----=====

 

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 5/5/2006

 

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 5/5/2006

 

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 5/5/2006

 

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 5/5/2006


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/334 - Release Date: 5/8/2006



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/334 - Release Date: 5/8/2006



Mime
View raw message