09123
2017-08-05 11:37ubuntu 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条回答
为你推荐
- 在ubuntu14.04上使用apache安装PHP5.3
- apache
- php
- 2个回答
- 发布请求不工作Drupal和Ubuntu 14.04
- apache
- drupal
- php
- 2个回答
- 请教如何在14.04lts的ubuntu下安装3.10.0的CMAKE?感激不尽!
- cmake
- ubuntu
- 3个回答
- ubuntu忘记用户名和密码
- 密码
- 2个回答
- Ubuntu 14.04下已经给adb设置了权限,为什么仍然还提示没有权限
- 2个回答
换一换