You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Henning Schmiedehausen <he...@intermeta.de> on 2003/06/16 11:42:13 UTC

Problems with POI and Umlauts

Hi,

I'm trying to read an Excel 97 spreadsheet  which contains two columns
of strings. These might contain german umlauts.

Unfortunately, POI returns "?" for these characters and does not
encode them correctly in Unicode. Is there any way for me to work 
around this?

Basically I do


String xlsFileName = "workbook.xls";
String sheetName = "Sheet_1";

POIFSFileSystem fs =
         new POIFSFileSystem(new FileInputStream(xlsFileName));
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet s = wb.getSheet(sheetName);
HSSFRow row = null;
int rowIndex = 0;

while((row = s.getRow(rowIndex++)) != null)
{
    HSSFCell cell = row.getCell((short)1);
    String value = cell.getStringCellValue();
    System.out.println("String is " + value);
}

And the string contains "?" where in the spreadsheet I have "äöü".

Any ideas? I use POI 1.8.0-dev-20020919 with JSDK 1.4.1_02
on RedHat Linux 7.3

        Regards
                Henning


-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire


Re: Problems with POI and Umlauts

Posted by Henning Schmiedehausen <he...@intermeta.de>.
Hi,

just tried this this morning with the current CVS HEAD. No change in
behaviour. :-(

	Regards
		Henning


On Mon, 2003-06-16 at 12:57, Avik Sengupta wrote:
> Many problems with encoding have been fixed in later versions of POI.
> Can i ask you to try the same code with th 2.0pre release?
> 
> Thanks
> -
> avik
> 
> 
> On Mon, 2003-06-16 at 15:12, Henning Schmiedehausen wrote:
> > Hi,
> > 
> > I'm trying to read an Excel 97 spreadsheet  which contains two columns
> > of strings. These might contain german umlauts.
> > 
> > Unfortunately, POI returns "?" for these characters and does not
> > encode them correctly in Unicode. Is there any way for me to work 
> > around this?
> > 
> > Basically I do
> > 
> > 
> > String xlsFileName = "workbook.xls";
> > String sheetName = "Sheet_1";
> > 
> > POIFSFileSystem fs =
> >          new POIFSFileSystem(new FileInputStream(xlsFileName));
> > HSSFWorkbook wb = new HSSFWorkbook(fs);
> > HSSFSheet s = wb.getSheet(sheetName);
> > HSSFRow row = null;
> > int rowIndex = 0;
> > 
> > while((row = s.getRow(rowIndex++)) != null)
> > {
> >     HSSFCell cell = row.getCell((short)1);
> >     String value = cell.getStringCellValue();
> >     System.out.println("String is " + value);
> > }
> > 
> > And the string contains "?" where in the spreadsheet I have "äöü".
> > 
> > Any ideas? I use POI 1.8.0-dev-20020919 with JSDK 1.4.1_02
> > on RedHat Linux 7.3
> > 
> >         Regards
> >                 Henning


Re: Problems with POI and Umlauts

Posted by Avik Sengupta <av...@apache.org>.
Many problems with encoding have been fixed in later versions of POI.
Can i ask you to try the same code with th 2.0pre release?

Thanks
-
avik


On Mon, 2003-06-16 at 15:12, Henning Schmiedehausen wrote:
> Hi,
> 
> I'm trying to read an Excel 97 spreadsheet  which contains two columns
> of strings. These might contain german umlauts.
> 
> Unfortunately, POI returns "?" for these characters and does not
> encode them correctly in Unicode. Is there any way for me to work 
> around this?
> 
> Basically I do
> 
> 
> String xlsFileName = "workbook.xls";
> String sheetName = "Sheet_1";
> 
> POIFSFileSystem fs =
>          new POIFSFileSystem(new FileInputStream(xlsFileName));
> HSSFWorkbook wb = new HSSFWorkbook(fs);
> HSSFSheet s = wb.getSheet(sheetName);
> HSSFRow row = null;
> int rowIndex = 0;
> 
> while((row = s.getRow(rowIndex++)) != null)
> {
>     HSSFCell cell = row.getCell((short)1);
>     String value = cell.getStringCellValue();
>     System.out.println("String is " + value);
> }
> 
> And the string contains "?" where in the spreadsheet I have "äöü".
> 
> Any ideas? I use POI 1.8.0-dev-20020919 with JSDK 1.4.1_02
> on RedHat Linux 7.3
> 
>         Regards
>                 Henning
-- 
Avik Sengupta <av...@apache.org>