characterset.java
来自「struts hibernate spring」· Java 代码 · 共 63 行
JAVA
63 行
package com.syfxapp.util;
import java.util.*;
import java.io.*;
public class CharacterSet {
public static String Iso2Gb(String str)
throws UnsupportedEncodingException
{
String result = null;
if(str==null)
return null;
if (str.equals(""))
return null;
else{byte temp[] = str.getBytes("iso-8859-1");
result = new String(temp, "gbk");
}
return result;
}
public static String Gb2Iso(String str)
throws UnsupportedEncodingException
{
if(str.equals(""))
{
return null;
} else
{
String result = null;
byte temp[] = str.getBytes("gb2312");
result = new String(temp, "iso-8859-1");
return result;
}
}
public static String Utf2Gb(String str)
throws UnsupportedEncodingException
{
if(str.equals(""))
{
return null;
} else
{
String result = null;
byte temp[] = str.getBytes("utf8");
result = new String(temp, "gb2312");
return result;
}
}
public static String Gb2utf(String str)
throws UnsupportedEncodingException
{
if(str.equals(""))
{
return null;
} else
{
String result = null;
byte temp[] = str.getBytes("gb2312");
result = new String(temp, "utf8");
return result;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?