mirror of https://github.com/apache/poi.git
UnicodeString now does not do the peculiar new String(getBytes("Unicode"),"Unicode") when serializing.
I doubt that this will have an effect on the serialization on non UTF8 platforms, but not having one of these to test on i dont know for 100%. Please if anyone can try this with their code with a non-8bit character set please do and let us know of any issues git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353777 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6313c0f05c
commit
0c9120905f
|
@ -19,6 +19,7 @@
|
||||||
package org.apache.poi.hssf.record;
|
package org.apache.poi.hssf.record;
|
||||||
|
|
||||||
import org.apache.poi.util.BitField;
|
import org.apache.poi.util.BitField;
|
||||||
|
import org.apache.poi.util.BitFieldFactory;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.HexDump;
|
import org.apache.poi.util.HexDump;
|
||||||
|
|
||||||
|
@ -48,9 +49,9 @@ public class UnicodeString
|
||||||
private String field_3_string; // = null;
|
private String field_3_string; // = null;
|
||||||
private List field_4_format_runs;
|
private List field_4_format_runs;
|
||||||
private byte[] field_5_ext_rst;
|
private byte[] field_5_ext_rst;
|
||||||
private BitField highByte = new BitField(0x1);
|
private BitField highByte = BitFieldFactory.getInstance(0x1);
|
||||||
private BitField extBit = new BitField(0x4);
|
private BitField extBit = BitFieldFactory.getInstance(0x4);
|
||||||
private BitField richText = new BitField(0x8);
|
private BitField richText = BitFieldFactory.getInstance(0x8);
|
||||||
|
|
||||||
public static class FormatRun implements Comparable {
|
public static class FormatRun implements Comparable {
|
||||||
private short character;
|
private short character;
|
||||||
|
@ -550,8 +551,7 @@ public class UnicodeString
|
||||||
|
|
||||||
byte[] strBytes = null;
|
byte[] strBytes = null;
|
||||||
try {
|
try {
|
||||||
//JMH Why does this do this?
|
String unicodeString = getString();
|
||||||
String unicodeString = new String(getString().getBytes("Unicode"),"Unicode");
|
|
||||||
if (!isUncompressedUnicode())
|
if (!isUncompressedUnicode())
|
||||||
{
|
{
|
||||||
strBytes = unicodeString.getBytes("ISO-8859-1");
|
strBytes = unicodeString.getBytes("ISO-8859-1");
|
||||||
|
@ -562,17 +562,8 @@ public class UnicodeString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
try {
|
|
||||||
if (!isUncompressedUnicode()) {
|
|
||||||
strBytes = getString().getBytes("ISO-8859-1");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
strBytes = getString().getBytes("UTF-16LE");
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new InternalError();
|
throw new InternalError();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (strSize != strBytes.length)
|
if (strSize != strBytes.length)
|
||||||
throw new InternalError("That shouldnt have happened!");
|
throw new InternalError("That shouldnt have happened!");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue