场景:
使用JAVA的 org.apache.batik 从SVG代码生成PNG图片
public static void convertToPng(String svgCode, OutputStream outputStream){
try {
byte[] bytes = svgCode.getBytes("utf-8");
PNGTranscoder t = new PNGTranscoder();
TranscoderInput input = new TranscoderInput(new ByteArrayInputStream(bytes));
TranscoderOutput output = new TranscoderOutput(outputStream);
t.transcode(input, output);
outputStream.flush();
} catch (Exception e) {
}finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
}
}
}
}
问题:
本地测试均好使,但是使用Docker部署后,发现生成的图片,中文是乱码的。
如图: