HBASE中文转换

/**
2 * HBASE中文转换
3 */
4 @Test
5 public void testHbaseStr() throws Exception {
6 // Hbase UTF8编码
7 String content = “\xE7\x83\xA6”;
8 char[] chars = content.toCharArray();
9 StringBuffer sb = new StringBuffer();
10 for (int i = 2; i < chars.length; i = i + 4) {
11 // System.out.println(chars[i]);
12 sb.append(chars[i]);
13 // System.out.println(chars[i + 1]);
14 sb.append(chars[i + 1]);
15 }
16 System.out.println(sb);
17 String ouputStr = new String(Hex.decodeHex(sb.toString().toCharArray()), “UTF-8”);
18 System.out.println(ouputStr);
19 }

你可能感兴趣的:(hbase)