问下大家为什么我输出 "郑泉" 这个字符串到文本里会出现乱码,其他的就不会呢
问下编码保存格式要求是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();
解决方案 »
- corba改成jms
- Spring的迭代事务问题
- 急!!!!opensymphony.xwork2.ActionSupport 问题
- 关于weblogic配置多服务器集群的问题
- JavaScript获取窗口与窗口之间数据
- Compass的Data Mirror谁用过?急
- 编译sessionbean时出错?
- JAppet 找不到,请帮我。
- 请问哪位有简单但是具体的EJB(session bean,entity bean)的实例
- 关于applet读写文件的security的问题。
- JBPM4.3中org.hibernate.exception.SQLGrammarException: could not execute query
- web项目启动报错!
试试
试试
InputStream is = new ByteArrayInputStream("郑泉".getBytes("UTF-8"));