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 ); + } }