Coder { public static String cnToUnicode(String cn) { char[] charArray = cn.toCharArray(); String returnStr = ""; for (char eachChar : charArray) { returnStr += "\\u" + Integer.toString(eachChar, 16); } return returnStr; } private  Coder(); static String checkMd5(String originStr); static String checkMd5(byte[] msg); static String encryptPassWithSlat(String passwordMd5, String key); static String decryptPsWithSlat(String desPassword, String key); static boolean manyMd5PasswordCompare(String originPassword, String predictPassword, int loop); static String encryptHex(byte[] b); static byte[] decryptHex(String s); static String encodeBASE64(byte[] key); static byte[] decodeBASE64(String key); static String encodeMd5StrAndBase64(String origin); static String encodeMd5ByteAndBase64(String origin); static String encodeSHA1(String data); static String encodeSHA1ByDigestUtils(String data); static String encodeSHA256(String data); static String encodeSHA256ByDigestUtils(String data); static String initMacKey(); static byte[] encryptHMAC(byte[] data, String key); static String encryptHmacSha256(String data, String key); static String unicodeToCn(String unicode); static String cnToUnicode(String cn);  }
@Test public void cnToUnicode() { String origin = "测试unicode转码"; String result = Coder.cnToUnicode(origin); logger.info("cnToUnicode, origin: [{}], result: [{}]", origin, result); }