Bug 15492

Summary: Add a method to set the encoding when reading a spreadsheet
Product: POI Reporter: Bob Moore <bob.moore>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P3    
Version: 2.0-dev   
Target Milestone: ---   
Hardware: Sun   
OS: Solaris   

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)