悲惨世界可爱的我 2015-09-21 14:32 采纳率: 0%
浏览 3962

liuix用HtmlImageGenerator生成图片乱码问题

代码如下 :
ImageOutputStream imOut = null;
byte[] b = null;
try {
//html转image工具类
HtmlImageGenerator imageGenerator = new HtmlImageGenerator();
//加载html
imageGenerator.loadHtml(“

中国”);
//拿图片流
BufferedImage bufferedImage = imageGenerator.getBufferedImage();
bufferedImage.flush();
//写图片流
ByteArrayOutputStream bs = new ByteArrayOutputStream();

imOut = ImageIO.createImageOutputStream(bs);
ImageIO.write(bufferedImage, "png",imOut);
//拿到图片流
b = bs.toByteArray();
return b;
} catch (IOException e) {
e.printStackTrace();
}
最后把byte[]写成图片文件,在window测试时没有问题的,可是liuix下中文就是一个一个的方块,中文完全显示不出来,我在服务器的jre的fonts文件夹下添加了字体也没有起作用,求大神帮忙解~急等。。。
  • 写回答

1条回答 默认 最新

  • threenewbee 2015-09-21 14:47
    关注

    JVM的字库、操作系统的locale设置、JVM的默认locale设置、应用程序中的locale设置

    http://blog.csdn.net/zgmzyr/article/details/6095329

    评论

报告相同问题?

悬赏问题

  • ¥50 汇编语言除法溢出问题
  • ¥50 C++实现删除N个数据列表共有的元素
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗