new String( string.getBytes("iso-8859-1"), "GB2312")
我知道 string.getBytes("iso-8859-1")是为了得到原来的字节串,但new String( string.getBytes("iso-8859-1"), "GB2312") 之后我认为应该是得到ANSI编码的字符串,但为什么是Unicode字符串呢?
我知道 string.getBytes("iso-8859-1")是为了得到原来的字节串,但new String( string.getBytes("iso-8859-1"), "GB2312") 之后我认为应该是得到ANSI编码的字符串,但为什么是Unicode字符串呢?
解决方案 »
- JApplet可以在appletViewer中查看…却不能在HTML中运行…求解……
- 每日一题
- 如何让JAVA编写的浏览器支持CSS
- Erroe:no 'server' JVM at 'F:\jre1.5.0\bin\server\jvm.dll
- 2个外网之间的机器 如何实现文件传输(Tcp or UDP)
- 求助:关于Java泛型通配符
- 请教我在包含有连接对象的一个类对象序例化时,报错:java.io.NotSerializableException: oracle.jdbc.driver.OracleConnection是什么原
- 还有两题
- 用Serializable实现的对象可以用流的形式存储在磁盘上,可再生,以后可以再取出来,请教!!!送分!!!
- 新手的愚蠢问题
- 关于单选按钮事件监听
- 如何将ArrayList 写入 txt文件
String s2 = new String(s1.getBytes(“ISO-8859-1”),”GBK”);utf-8解决JSP中文乱码问题,在页面的开始处加:
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%> <%request.setCharacterEncoding("UTF-8");%>如果仍不能解决问题,还需要这样处理一下:
String msg = request.getParameter("message");
String str=new String(msg.getBytes("ISO-8859-1"),"UTF-8");out.println(st);