diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java b/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java index 8dada5a..90febbc 100644 --- a/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java +++ b/serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java @@ -555,6 +555,9 @@ public static Text transformTextToUTF8(Text text, Charset previousCharset) { } public static Text transformTextFromUTF8(Text text, Charset targetCharset) { - return new Text(new String(text.getBytes()).getBytes(targetCharset)); + int length=text.getLength(); + byte[] realContent = new byte[length]; + System.arraycopy(text.getBytes(), 0, realContent, 0, length); + return new Text(new String(realContent, targetCharset)); } }