You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2021/02/21 18:52:23 UTC
svn commit: r1886768 -
/poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/SVGFormat.java
Author: kiwiwings
Date: Sun Feb 21 18:52:23 2021
New Revision: 1886768
URL: http://svn.apache.org/viewvc?rev=1886768&view=rev
Log:
Use UTF-8 when writing SVG files
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/SVGFormat.java
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/SVGFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/SVGFormat.java?rev=1886768&r1=1886767&r2=1886768&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/SVGFormat.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/SVGFormat.java Sun Feb 21 18:52:23 2021
@@ -22,7 +22,10 @@ package org.apache.poi.xslf.util;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
import org.apache.batik.dom.GenericDOMImplementation;
import org.apache.batik.svggen.SVGGraphics2D;
@@ -55,7 +58,11 @@ public class SVGFormat implements Output
@Override
public void writeSlide(MFProxy proxy, File outFile) throws IOException {
- svgGenerator.stream(outFile.getCanonicalPath(), true);
+ // Batik DEFAULT_XML_ENCODING is ISO-8859-1 ... srsly?!
+ // Unicode entities aren't encoded, so use UTF-8
+ try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(outFile.getCanonicalPath()), StandardCharsets.UTF_8)) {
+ svgGenerator.stream(writer, true);
+ }
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org