<%!
//处理中文问题的自定义函数
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)
{
e.printStackTrace();
}
return "null";
}
%>
//处理中文问题的自定义函数
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)
{
e.printStackTrace();
}
return "null";
}
%>
本文介绍了一个用于处理中文字符串的自定义函数getStr。该函数通过将输入的中文字符串从ISO-8859-1编码转换为适合浏览器显示的编码格式,解决了中文字符在特定环境下可能出现的乱码问题。

被折叠的 条评论
为什么被折叠?



