处理字符串 将字符串中的unicode字符转为汉字
public class UnicodeUtil {
/**
* 处理字符串 将字符串中的unicode字符转为汉字
* @param asciicode
* @return
*/
public static String ascii2native ( String asciicode )
{
String[] asciis = asciicode.split ("\\\\u");
StringBuffer nativeValue = new StringBuffer();
nativeValue.append(asciis[0]) ;
try
{
for ( int i = 1; i < asciis.length; i++ )
{
String code = asciis[i];
nativeValue.append((char) Integer.parseInt (code.substring (0, 4), 16));
if (code.length () > 4)
{
nativeValue.append(code.substring (4, code.length ())) ;
}
}
}
catch (NumberFormatException e)
{
return asciicode;
}
return nativeValue.toString();
}
}