public class Unicode {
/**
* character to unicode
*/
public static String encode(char c) {
return Integer.toHexString((int) c & 0xffff);
}
/**
* unicode to character
*/
public static char decode(String unicode) {
return (char) Integer.parseInt(unicode, 16);
}
}
/**
* character to unicode
*/
public static String encode(char c) {
return Integer.toHexString((int) c & 0xffff);
}
/**
* unicode to character
*/
public static char decode(String unicode) {
return (char) Integer.parseInt(unicode, 16);
}
}
Unicode与字符编码转换
10万+

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



