ASF Bugzilla – Attachment 21110 Details for
Bug 43837
[PATCH] cant open Excel file with unicode NameRecord
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
unicodeNameRecord.patch
unicodeNameRecord.patch (text/plain), 2.90 KB, created by
Yasuo Nakanishi
on 2007-11-11 08:53:45 UTC
(
hide
)
Description:
unicodeNameRecord.patch
Filename:
MIME Type:
Creator:
Yasuo Nakanishi
Created:
2007-11-11 08:53:45 UTC
Size:
2.90 KB
patch
obsolete
>Index: src/java/org/apache/poi/hssf/record/NameRecord.java >=================================================================== >--- src/java/org/apache/poi/hssf/record/NameRecord.java (revision 592521) >+++ src/java/org/apache/poi/hssf/record/NameRecord.java (working copy) >@@ -725,7 +725,7 @@ > field_12_builtIn_name = in.readByte(); > } else { > if (field_11_compressed_unicode_flag == 1) { >- field_12_name_text = in.readCompressedUnicode(field_3_length_name_text); >+ field_12_name_text = in.readUnicodeLEString(field_3_length_name_text); > } else { > field_12_name_text = in.readCompressedUnicode(field_3_length_name_text); > } >Index: src/testcases/org/apache/poi/hssf/record/TestNameRecord.java >=================================================================== >--- src/testcases/org/apache/poi/hssf/record/TestNameRecord.java (revision 592521) >+++ src/testcases/org/apache/poi/hssf/record/TestNameRecord.java (working copy) >@@ -24,6 +24,7 @@ > * Tests the NameRecord serializes/deserializes correctly > * > * @author Danny Mui (dmui at apache dot org) >+ * @author Yasuo Nakanishi > */ > public class TestNameRecord > extends TestCase >@@ -62,6 +63,37 @@ > > } > >+ /** >+ * Makes sure that additional name information is parsed properly such as menu/description >+ */ >+ public void testUnicodeNameRecord() >+ { >+ >+ // using unicode name from examples[11]. String length is 3(6 bytes) >+ byte[] examples = { >+ (byte) 0x88, (byte) 0x03, (byte) 0x67, (byte) 0x03, >+ (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x00, >+ (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x23, >+ (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0xE5, >+ (byte) 0x65, (byte) 0x2C, (byte) 0x67, (byte) 0x9E, >+ (byte) 0x8A, (byte) 0x3A, (byte) 0x01, (byte) 0x00, >+ (byte) 0x00, (byte) 0x00, (byte) 0x11, (byte) 0x00, >+ (byte) 0x00, (byte) 0x4D, (byte) 0x61, (byte) 0x63, >+ (byte) 0x72, (byte) 0x6F, (byte) 0x20, (byte) 0x72, >+ (byte) 0x65, (byte) 0x63, (byte) 0x6F, (byte) 0x72, >+ (byte) 0x64, (byte) 0x65, (byte) 0x64, (byte) 0x20, >+ (byte) 0x32, (byte) 0x37, (byte) 0x2D, (byte) 0x53, >+ (byte) 0x65, (byte) 0x70, (byte) 0x2D, (byte) 0x39, >+ (byte) 0x33, (byte) 0x20, (byte) 0x62, (byte) 0x79, >+ (byte) 0x20, (byte) 0x41, (byte) 0x4C, (byte) 0x4C, >+ (byte) 0x57, (byte) 0x4F, (byte) 0x52 >+ }; >+ >+ NameRecord name = new NameRecord(new TestcaseRecordInputStream(NameRecord.sid, (short) examples.length, examples)); >+ String result = name.getNameText(); >+ assertNotNull( result ); >+ assertTrue( "text contains jp name", result.indexOf("\u65E5\u672C\u8A9E") != -1 ); >+ } > }
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 43837
: 21110 |
21111