Here you can find the source of toUnicode(String original)
public static String toUnicode(String original)
//package com.java2s; //License from project: Apache License public class Main { public static String toUnicode(String original) { if (original == null) return null; String result = ""; for (int i = 0, length = original.length(); i < length; i++) { if (original.charAt(i) > 0 && original.charAt(i) < 256) result += original.charAt(i); else/*from www .j a v a 2s.co m*/ result += "\\u" + Integer.toHexString(original.charAt(i)).toUpperCase(); } return result; } }