LINUX JAVA乱码!
代码如下:
String sql = "Select * from t_recieve where Sourceid='" + userid +
"' and state=0 and rownum=1";
// System.out.println(sql);
ResultSet rs1 = stmt.executeQuery(sql);
if (rs1.absolute(1)) {
String msgcontent = rs1.getString("Recontent").trim();
String msgcontent2 = new String(msgcontent.getBytes("GB2312"),
"ISO-8859-1");
String msgcontent3 = new String(msgcontent.getBytes("ISO-8859-1"),
"GB2312");
String msgcontent4 = new String(msgcontent2.getBytes("ISO-8859-1"),
"GB2312");
msgcontent = java.net.URLEncoder.encode(msgcontent);
System.out.println(msgcontent);
System.out.println(msgcontent2);
System.out.println(msgcontent3);
System.out.println(msgcontent4);
显示:
%E5%9B%9E%E5%A4%8D%EF%BC%9A%E5%A5%BD%E7%9A%84%E4%BA%86
»Ø¸´£ººÃµÄÃË
?????:好的了