Browse Source

Use UTF-8 when writing SVG files

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1886768 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_1_0
Andreas Beeker 3 years ago
parent
commit
6d10f26718
1 changed files with 8 additions and 1 deletions
  1. 8
    1
      src/ooxml/java/org/apache/poi/xslf/util/SVGFormat.java

+ 8
- 1
src/ooxml/java/org/apache/poi/xslf/util/SVGFormat.java View File

import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;


import org.apache.batik.dom.GenericDOMImplementation; import org.apache.batik.dom.GenericDOMImplementation;
import org.apache.batik.svggen.SVGGraphics2D; import org.apache.batik.svggen.SVGGraphics2D;


@Override @Override
public void writeSlide(MFProxy proxy, File outFile) throws IOException { 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 @Override

Loading…
Cancel
Save