悲惨世界可爱的我 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

    评论

报告相同问题?

悬赏问题

  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝