diff --git a/src/main/java/org/olat/core/util/openxml/OpenXMLDocument.java b/src/main/java/org/olat/core/util/openxml/OpenXMLDocument.java index 6106efb167d0c96b94e29c0749e57b8522c868bf..98a2eeb95ee1a8620f5ddf6b8faca897d9c5b2fb 100644 --- a/src/main/java/org/olat/core/util/openxml/OpenXMLDocument.java +++ b/src/main/java/org/olat/core/util/openxml/OpenXMLDocument.java @@ -102,6 +102,9 @@ public class OpenXMLDocument { public void setDocumentHeader(String header) { documentHeader = header; + if(StringHelper.containsNonWhitespace(documentHeader)) { + documentHeader = documentHeader.replace("&", "&"); + } } public VFSContainer getMediaContainer() { diff --git a/src/main/java/org/olat/core/util/openxml/OpenXMLDocumentWriter.java b/src/main/java/org/olat/core/util/openxml/OpenXMLDocumentWriter.java index 89d0697d6574f8efa74efb3571e42f3680c2186b..2d05fbbc7b4d4d8f4516a971092da8486ab7d3fc 100644 --- a/src/main/java/org/olat/core/util/openxml/OpenXMLDocumentWriter.java +++ b/src/main/java/org/olat/core/util/openxml/OpenXMLDocumentWriter.java @@ -23,6 +23,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.charset.Charset; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -110,7 +111,7 @@ public class OpenXMLDocumentWriter { for(HeaderReference headerRef:document.getHeaders()) { ZipEntry headerDocument = new ZipEntry("word/" + headerRef.getFilename()); out.putNextEntry(headerDocument); - IOUtils.write(headerRef.getHeader(), out); + IOUtils.write(headerRef.getHeader(), out, Charset.forName("UTF-8")); out.closeEntry(); }