SVG文件转图片乱码

J2EE 码拜 8年前 (2015-11-16) 1923次浏览
public static void convertSvgFile2Png(File svg, File png)
			throws IOException, TranscoderException {
		InputStream in = new FileInputStream(svg);
		InputStreamReader is = new InputStreamReader(in);
		OutputStream out = new FileOutputStream(png);
		FileOutputStream fos = new FileOutputStream(png);
//		OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8");
		Transcoder transcoder = new PNGTranscoder();
		TranscoderInput input = new TranscoderInput(is);
		TranscoderOutput output = new TranscoderOutput(out);
		transcoder.transcode(input, output);
		in.close();
		out.flush();
		out.close();
	}

环境是这样的,本来本人本地的是GBK,本人全用的GBK,转出来没问题,
但现在问题的服务器上是UTF-8的环境,所以本人把InputStream 改为了UTF-8
本来想把OutputStream也改为Utf-8,但是TranscoderOutput 他不接受OutputStreamWriter 类型,
求大家帮看看,这样的问题怎么解决啊,TranscoderOutput 这个也没看到设置编码的东西,
两个文件都是设置的UTF-8,没有乱码.

解决方案:100分
什么叫全部 可以一个一个的取的 建议你再开一个贴 正则的贴很多人回的

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明SVG文件转图片乱码
喜欢 (0)
[1034331897@qq.com]
分享 (0)