09123 2017-08-05 11:37 采纳率: 0%
浏览 731

ubuntu 14.04导出图片名称部分汉字乱码

例如:司薇等汉字,
代码如下:
filename = new String(filename.getBytes("utf-8"),"UTF-8");
//构造URL
URL url = new URL(replace);
//打开连接
URLConnection conn = url.openConnection();
conn.setRequestProperty("User-Agent", "Mozilla/4.0(compatible;MSIE 5.0;Windows NT;DigExt)");
//输入流
is = conn.getInputStream();
//1k的数据缓冲
byte[] bs = new byte[1024];
int len;
//输出的文件流
os = new FileOutputStream(filename,true);
//开始读取
while((len = is.read(bs)) != -1){
os.write(bs,0,len);
}

  • 写回答

1条回答 默认 最新

  • dabocaiqq 2018-06-19 16:29
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp