Bug 15492 - Add a method to set the encoding when reading a spreadsheet
Summary: Add a method to set the encoding when reading a spreadsheet
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-dev
Hardware: Sun Solaris
: P3 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-18 18:09 UTC by Bob Moore
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Moore 2002-12-18 18:09:44 UTC
When POI reads a spreadsheet, it uses the operating system's default character 
encoding to process the data.  This presents a problem when reading UTF-8 
characters on a platform that defaults to a different encoding.  It would be 
useful to provide a way to set the encoding.

The code that processes the data is at line 156 of 
poi/hssf/record/UnicodeString.java.  I replaced
            field_3_string = new String(data, 3, getCharCount());
with
            try
            {
                field_3_string = 
                    new String(data, 3, getCharCount(), "ISO-8859-1");
            }
            catch(Exception ex)
            {
                field_3_string = new String(data, 3, getCharCount());
            }

to read my spreadsheet.  A method to set the encoding would be wondeful.
Comment 1 Andy Oliver 2002-12-18 19:22:29 UTC
Grab a recent nightly build.  Its been fixed and will make the next prod release
(2.0)