diff --git a/src/java/org/apache/poi/hpsf/MutableProperty.java b/src/java/org/apache/poi/hpsf/MutableProperty.java index 1aa603a4a..e80644b19 100644 --- a/src/java/org/apache/poi/hpsf/MutableProperty.java +++ b/src/java/org/apache/poi/hpsf/MutableProperty.java @@ -108,6 +108,11 @@ public class MutableProperty extends Property { int length = 0; long variantType = getType(); + + /* Ensure that wide strings are written if the codepage is Unicode. */ + if (codepage == Constants.CP_UNICODE && variantType == Variant.VT_LPSTR) + variantType = Variant.VT_LPWSTR; + length += TypeWriter.writeUIntToStream(out, variantType); length += VariantSupport.write(out, variantType, getValue(), codepage); return length;