View | Details | Raw Unified | Return to bug 43837
Collapse All | Expand All

(-)src/java/org/apache/poi/hssf/record/NameRecord.java (-1 / +1 lines)
Lines 725-731 Link Here
725
                field_12_builtIn_name = in.readByte();
725
                field_12_builtIn_name = in.readByte();
726
        } else {                
726
        } else {                
727
          if (field_11_compressed_unicode_flag == 1) {
727
          if (field_11_compressed_unicode_flag == 1) {
728
            field_12_name_text = in.readCompressedUnicode(field_3_length_name_text);
728
            field_12_name_text = in.readUnicodeLEString(field_3_length_name_text);
729
          } else {
729
          } else {
730
            field_12_name_text = in.readCompressedUnicode(field_3_length_name_text);
730
            field_12_name_text = in.readCompressedUnicode(field_3_length_name_text);
731
          }
731
          }
(-)src/testcases/org/apache/poi/hssf/record/TestNameRecord.java (+32 lines)
Lines 24-29 Link Here
24
 * Tests the NameRecord serializes/deserializes correctly
24
 * Tests the NameRecord serializes/deserializes correctly
25
 *
25
 *
26
 * @author Danny Mui (dmui at apache dot org)
26
 * @author Danny Mui (dmui at apache dot org)
27
 * @author Yasuo Nakanishi
27
 */
28
 */
28
public class TestNameRecord
29
public class TestNameRecord
29
        extends TestCase
30
        extends TestCase
Lines 62-67 Link Here
62
63
63
    }
64
    }
64
65
66
    /**
67
     * Makes sure that additional name information is parsed properly such as menu/description
68
     */
69
    public void testUnicodeNameRecord()
70
    {
71
72
    	// using unicode name from examples[11]. String length is 3(6 bytes)
73
        byte[] examples = {
74
                (byte) 0x88, (byte) 0x03, (byte) 0x67, (byte) 0x03,
75
                (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x00,
76
                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x23,
77
                (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0xE5,
78
                (byte) 0x65, (byte) 0x2C, (byte) 0x67, (byte) 0x9E,
79
                (byte) 0x8A, (byte) 0x3A, (byte) 0x01, (byte) 0x00,
80
                (byte) 0x00, (byte) 0x00, (byte) 0x11, (byte) 0x00,
81
                (byte) 0x00, (byte) 0x4D, (byte) 0x61, (byte) 0x63,
82
                (byte) 0x72, (byte) 0x6F, (byte) 0x20, (byte) 0x72,
83
                (byte) 0x65, (byte) 0x63, (byte) 0x6F, (byte) 0x72,
84
                (byte) 0x64, (byte) 0x65, (byte) 0x64, (byte) 0x20,
85
                (byte) 0x32, (byte) 0x37, (byte) 0x2D, (byte) 0x53,
86
                (byte) 0x65, (byte) 0x70, (byte) 0x2D, (byte) 0x39,
87
                (byte) 0x33, (byte) 0x20, (byte) 0x62, (byte) 0x79,
88
                (byte) 0x20, (byte) 0x41, (byte) 0x4C, (byte) 0x4C,
89
                (byte) 0x57, (byte) 0x4F, (byte) 0x52
90
            };
91
92
        NameRecord name = new NameRecord(new TestcaseRecordInputStream(NameRecord.sid, (short) examples.length, examples));
93
        String result = name.getNameText();
94
        assertNotNull( result );
95
        assertTrue( "text contains jp name", result.indexOf("\u65E5\u672C\u8A9E") != -1 );
96
    }
65
}
97
}

Return to bug 43837