问下大家为什么我输出 "郑泉" 这个字符串到文本里会出现乱码,其他的就不会呢
问下编码保存格式要求是ANSI。到底 "郑泉" 这是特殊字符,还是? 请教大家。附上以下代码:
InputStream is = new ByteArrayInputStream("郑泉".getBytes());
OutputStream os;
os = new FileOutputStream("d:\\qq.txt");
byte[] buffer = new byte[2048];
int length = 0;
while (-1 != (length = is.read(buffer, 0, buffer.length))) {
os.write(buffer, 0, length);
}
is.close();
os.close();
问下编码保存格式要求是ANSI。到底 "郑泉" 这是特殊字符,还是? 请教大家。附上以下代码:
InputStream is = new ByteArrayInputStream("郑泉".getBytes());
OutputStream os;
os = new FileOutputStream("d:\\qq.txt");
byte[] buffer = new byte[2048];
int length = 0;
while (-1 != (length = is.read(buffer, 0, buffer.length))) {
os.write(buffer, 0, length);
}
is.close();
os.close();
解决方案 »
- tomcat6错误
- 请教 过滤器问题 麻烦哪位帮帮忙
- 哪位高手能讲解一下这段代码?整数范围怎么控制在10万以内
- hibernate注解问题
- struts 源码中的例子如何导入到MyEclipse或是eclipse中
- 最近要写一篇关于SSH的论文,请大家帮忙给点建议
- 求ssh框架购物系统
- maven能分析jBuilder的项目吗?怎么做?
- struts中页面转向出现IllegalStateException,求教!!
- 怪事,劳烦各位朋友进来看看~
- JBPM4.3中org.hibernate.exception.SQLGrammarException: could not execute query
- web项目启动报错!
试试
试试
InputStream is = new ByteArrayInputStream("郑泉".getBytes("UTF-8"));