try{
out.println(new((new String("我家在南方")).getBytes("GBK"),"ISO8859-1"));
}catch(UnsupportedEncodingException e)
{
//......
} 或者用下面这个函数:
<%
public String getStr(String str){
try{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
return temp;
}catch(Exception e){
}
return "null";
}
%> 这是用来显示简体的,繁体我不知用什么字符集,不好意思
希望能管用,祝你好运
out.println(new((new String("我家在南方")).getBytes("GBK"),"ISO8859-1"));
}catch(UnsupportedEncodingException e)
{
//......
} 或者用下面这个函数:
<%
public String getStr(String str){
try{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
return temp;
}catch(Exception e){
}
return "null";
}
%> 这是用来显示简体的,繁体我不知用什么字符集,不好意思
希望能管用,祝你好运
解决方案 »
- 封装..
- java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对象名 'MyDatabase' 无效
- 运行JSP出现怪现
- javascrip如何判断日期格式
- struts options标签的问题
- tomcat5.5隔一断时间会与mylsq5.0数据库断开连接,紧急求解答,多谢!
- [求助]jsp无法连接到MySQL数据库,跪求帮助!
- 在发前面的问题!!mysql jdbc connection problem!!
- 怎么让客户端读取本地机器上的某个文件,并把读到的东西返回到服务器?
- 在web应用中声明的application对象能否被javabean引用?
- 如何将在tomcat里调试通过的程序发布到WEBSPHERE 3.5里?需要注意什么?
- 我的机器为什么没有运行JSP的程序?
还有关键的一点:
你一定要把jsp页面的字符集设置为GBK即可!
我试过可以同时输入简体和繁体,然后提交在同一个页面下正常显示!
GBK,后来又把他该为GIB5,就正常显示了,上面的兄弟告诉为什么!!
是不是服务器的问题!!!
等一下给你们分!!