public class CharacterCodeConversion {
public static String srcCharacter = "UTF-8";
public static String targetCharacter = "UTF-8";
public static String transfor(String str) {
String returnString = null;
return returnString;
}
public static String gbk2utf8(String str)
throws UnsupportedEncodingException {
// Step 1: 得到GBK编码下的字符数组,一个中文字符对应这里的一个c
char c[] = str.toCharArray();
// Step 2: UTF-8使用3个字节存放一个中文字符,所以长度必须为字符的3 倍
byte[] fullByte = new byte[3 * c.length];
try {
// Step 3: 循环将字符的GBK编码转换成UTF-8编码
for (int i = 0; i < c.length; i++) {
int m = (int) c[i];
Strin
public static String srcCharacter = "UTF-8";
public static String targetCharacter = "UTF-8";
public static String transfor(String str) {
String returnString = null;
return returnString;
}
public static String gbk2utf8(String str)
throws UnsupportedEncodingException {
// Step 1: 得到GBK编码下的字符数组,一个中文字符对应这里的一个c
char c[] = str.toCharArray();
// Step 2: UTF-8使用3个字节存放一个中文字符,所以长度必须为字符的3 倍
byte[] fullByte = new byte[3 * c.length];
try {
// Step 3: 循环将字符的GBK编码转换成UTF-8编码
for (int i = 0; i < c.length; i++) {
int m = (int) c[i];
Strin