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

(-)src/scratchpad/src/org/apache/poi/hsmf/datatypes/StringChunk.java (-1 / +19 lines)
Lines 18-24 Link Here
18
package org.apache.poi.hsmf.datatypes;
18
package org.apache.poi.hsmf.datatypes;
19
19
20
import java.io.ByteArrayOutputStream;
20
import java.io.ByteArrayOutputStream;
21
import java.io.UnsupportedEncodingException;
21
22
23
import org.apache.poi.hsmf.datatypes.Types;
24
22
/**
25
/**
23
 * A Chunk made up of a single string.
26
 * A Chunk made up of a single string.
24
 * @author Travis Ferguson
27
 * @author Travis Ferguson
Lines 61-67 Link Here
61
	 * @see org.apache.poi.hsmf.Chunk.Chunk#setValue(java.io.ByteArrayOutputStream)
64
	 * @see org.apache.poi.hsmf.Chunk.Chunk#setValue(java.io.ByteArrayOutputStream)
62
	 */
65
	 */
63
	public void setValue(ByteArrayOutputStream value) {
66
	public void setValue(ByteArrayOutputStream value) {
64
		this.value = value.toString().replaceAll("\0", "");
67
		if (type == Types.NEW_STRING)
68
		{
69
			try {
70
				this.value = new String(value.toByteArray(), "UTF-16LE");
71
			} catch (UnsupportedEncodingException e) {
72
				e.printStackTrace();
73
			}
74
		}
75
		else
76
		{
77
			try {
78
				this.value = new String(value.toByteArray(), "CP1252");
79
			} catch (UnsupportedEncodingException e) {
80
				e.printStackTrace();
81
			}
82
		}
65
	}
83
	}
66
84
67
	public String toString() {
85
	public String toString() {

Return to bug 47179