请问一个乱码的问题。急急急!! 自己可以根据你的现实需要来进行对输出的String来进行中文编码的处理! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String aa="中文内容";aa=new String(aa.getBytes("ISO-8859-1"),"GB2312"); public String getStr(String str){ try { if (str == null) { return "-"; } String temp_p=str; String temp=""; temp=new String(temp_p.getBytes("ISO8859_1"),"GBK").trim(); //return temp; return temp_p; } catch(Exception e) { System.out.println("get str exception: " + e.toString()); return "null"; } } String aa="中文内容";aa=new String(aa.getBytes("ISO8859_1"); 在类中写这两个方法中的任一个,调用就可以啦!public static String getGbcode(String str) { if(str == null) return ""; try { byte[]bytesStr = str.getBytes("ISO-8859-1"); return new String(bytesStr,"GBK"); } catch(Exception ex) { return str; } } public static String getUnicode(String str) { if(str == null) return ""; try { byte[]bytesStr = str.getBytes(); return new String(bytesStr,"ISO-8859-1"); } catch(Exception ex) { return str; } } UTF-8,我在一本书上看到,也是这样说的,但不知道为什么,谁能解释解释啊! 深入剖析Java编程中的中文问题及建议最优解决方法:http://dev.csdn.net/develop/article/27/27140.shtmhttp://dev.csdn.net/develop/article/27/27142.shtmJava 繁体中文处理完全攻略(蔡学镛)http://www.csdn.net/develop/author/cxy/java_big5_1.shtmhttp://www.csdn.net/develop/author/cxy/java_big5_2.shtm 初学Java Jframe按退出提醒保存,保存之后怎样直接退出 java多态 Swing 中的JList 下拉菜单等用法求救???? 高分求教,下一步该学什么? help!关于JLabel的重要难题! 继承环境下的编译与dos方式下命令行方式的编译有什么不一样吗? 高分求购Java1.3API手册 求实时获取日志文件变化内容的示例 并发编程题 100分请教,★★★★★是怎样炼成的? 怎么样用JAVA取得系统的路径?
aa=new String(aa.getBytes("ISO-8859-1"),"GB2312");
{
try
{
if (str == null)
{
return "-";
}
String temp_p=str;
String temp="";
temp=new String(temp_p.getBytes("ISO8859_1"),"GBK").trim();
//return temp;
return temp_p;
}
catch(Exception e)
{
System.out.println("get str exception: " + e.toString());
return "null";
}
}
aa=new String(aa.getBytes("ISO8859_1");
{
if(str == null)
return ""; try
{
byte[]bytesStr = str.getBytes("ISO-8859-1");
return new String(bytesStr,"GBK");
}
catch(Exception ex)
{
return str;
}
} public static String getUnicode(String str)
{
if(str == null)
return ""; try
{
byte[]bytesStr = str.getBytes();
return new String(bytesStr,"ISO-8859-1");
}
catch(Exception ex)
{
return str;
}
}
http://dev.csdn.net/develop/article/27/27140.shtm
http://dev.csdn.net/develop/article/27/27142.shtmJava 繁体中文处理完全攻略(蔡学镛)
http://www.csdn.net/develop/author/cxy/java_big5_1.shtm
http://www.csdn.net/develop/author/cxy/java_big5_2.shtm