ASF Bugzilla – Attachment 2331 Details for
Bug 10548
[PATCH] Unicode Support for excel sheetname.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
unicode name deserializing offered by Patrick Lee
patch1.txt (text/plain), 3.29 KB, created by
Sergei Kozello
on 2002-07-12 16:19:59 UTC
(
hide
)
Description:
unicode name deserializing offered by Patrick Lee
Filename:
MIME Type:
Creator:
Sergei Kozello
Created:
2002-07-12 16:19:59 UTC
Size:
3.29 KB
patch
obsolete
>Index: src/java/org/apache/poi/hssf/record/BoundSheetRecord.java >=================================================================== >RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/record/BoundSheetRecord.java,v >retrieving revision 1.4 >diff -r1.4 BoundSheetRecord.java >57a58,60 >> import java.io.UnsupportedEncodingException; >> >> import org.apache.poi.util.BinaryTree; >127a131,133 >> >> /* >> >130c136,152 >< } >--- >> */ >> BinaryTree tempBT = new BinaryTree(); >> SSTDeserializer deserializer = new SSTDeserializer( tempBT ); >> int length = LittleEndian.ubyteToInt( field_3_sheetname_length ); >> if ( ( field_4_compressed_unicode_flag & 0x01 ) == 1 ) { >> byte [] newData = new byte[length*2 + 3]; >> System.arraycopy( data, 7 + offset, newData, 2, length*2 + 1 ); >> >> LittleEndian.putShort( newData, 0, (short)data[ 6 + offset ] ); >> deserializer.manufactureStrings( newData, 0, (short)( length * 2 + 3 ) ); >> field_5_sheetname = ( (UnicodeString)tempBT.get( new Integer(0) ) ).getString(); >> } >> else { >> field_5_sheetname = new String( data, 8 + offset, >> LittleEndian.ubyteToInt( field_3_sheetname_length ) ); >> } >> } >172c194 >< public void setCompressedUnicodeFlag(byte flag) >--- >> public void setCompressedUnicodeFlag( byte flag ) >181,182c203,204 >< >< public void setSheetname(String sheetname) >--- >> >> public void setSheetname( String sheetname ) >265,266c287,288 >< LittleEndian.putShort(data, 2 + offset, >< ( short ) (0x08 + getSheetnameLength())); >--- >> LittleEndian.putShort( data, 2 + offset, >> (short)( 0x08 + getSheetnameLength() ) ); >268a291 >> /* >270a294,325 >> */ >> >> // DEBUG >> byte[] oldbs = new byte[ 3 + 2 * getSheetnameLength() ]; >> oldbs[ 0 ] = 0; >> oldbs[ 1 ] = (byte)( 2*getSheetnameLength() ); >> oldbs[ 2 ] = (byte)getCompressedUnicodeFlag(); >> StringUtil.putUncompressedUnicode( getSheetname(), oldbs, 3 ); >> for ( int i = 0; i < oldbs.length; i++ ) { >> System.out.print( (char)oldbs[i] ); >> } >> System.out.println(); >> >> // we assume internationality! ;) >> UnicodeString name = new UnicodeString(); >> name.setOptionFlags( (byte)( field_4_compressed_unicode_flag & 0x01 ) ); >> name.setString( getSheetname() ); >> >> // System.arraycopy( name.serialize(), 0, data, 10 + offset, name.getRecordSize() ); >> System.arraycopy( oldbs, 0, data, 10 + offset, oldbs.length ); >> >> // DEBUG >> byte[] bs = name.serialize(); >> for ( int i = 0; i < bs.length; i++ ) { >> System.out.print( (char)bs[i] ); >> } >> System.out.println(); >> // DEBUG >> System.out.println( name.getDebugInfo() ); >> // DEBUG >> System.out.println( toString() ); >> >272,273d326 >< // we assume compressed unicode (bein the dern americans we are ;-p) >< StringUtil.putCompressedUnicode(getSheetname(), data, 12 + offset);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 10548
: 2331 |
2332
|
2333
|
2422
|
2423
|
2424
|
2430