jsp转码类
来源:互联网 发布:平面设计网站 知乎 编辑:程序博客网 时间:2024/06/05 19:26
package db;
import java.io.UnsupportedEncodingException;
public class ChangeChar {
public ChangeChar() {
}
public static String Char(String str) {
String value = "";
String check = System.getProperty("os.name").toLowerCase();
if (str != null)
try {
if (check.indexOf("win") != -1) {
value = new String(str.getBytes("ISO-8859-1"));
} else {
value = new String(str.getBytes(), "GB2312");
}
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
return value;
}
public String gb2iso(String qs) {
try {
if (qs == null)
return "NULL";
else
return new String(qs.getBytes("gb2312"), "iso-8859-1");
} catch (Exception e) {
}
return "NULL";
}
public String Convert(String s){
String result = null;
byte[] temp = null ;
try {
temp = s.getBytes("iso-8859-1");
} catch (UnsupportedEncodingException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
try {
result = new String(temp,"utf-8");
} catch (UnsupportedEncodingException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
return result;
}
public String Convert1(String s){
String result = null;
byte[] temp = null ;
try {
temp = s.getBytes("utf-8");
} catch (UnsupportedEncodingException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
try {
result = new String(temp,"iso-8859-1");
} catch (UnsupportedEncodingException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
return result;
}
}
- jsp转码类
- JSP
- JSP
- jsp
- JSP
- JSP
- jsp
- Jsp
- JSP
- jsp
- jsp
- jsp
- JSP
- JSP
- jsp
- jsp
- JSP
- jsp
- Chrome
- 使用U盘时候的"无法停用通用卷"的解决办法
- Java基础之 与equals()如影随行的hashCode()
- ASPNET一个错误记录错误 1 未能找到元数据文件“C:/windows/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServi
- 针对信息设备的Java实时虚拟机
- jsp转码类
- 操作系统总结一(操作系统引论)
- Thread Dump 和Java应用诊断
- 使用浮点数和小数中的技巧和陷阱
- 不唐突的JavaScript的七条准则
- 在JAVA中如何实现浮点数的计算
- 智能排版助手 Gidot Typesetter 3.0.7 !
- Win2003 Server實驗筆記(One)
- java浮点数运算在计算器上的应用