Here you can find the source of unescape(String src)
public static String unescape(String src)
//package com.java2s; //License from project: Apache License public class Main { public static String unescape(String src) { StringBuilder sb = new StringBuilder(); sb.ensureCapacity(src.length()); int lastPos = 0; int pos = 0; while (lastPos < src.length()) { pos = src.indexOf("%", lastPos); if (pos == lastPos) { if (src.charAt(pos + 1) == 'u') { char ch = (char) Integer.parseInt(src.substring(pos + 2, pos + 6), 16); sb.append(ch);//from ww w. j ava2 s . c o m lastPos = pos + 6; } else { char ch = (char) Integer.parseInt(src.substring(pos + 1, pos + 3), 16); sb.append(ch); lastPos = pos + 3; } } else if (pos == -1) { sb.append(src.substring(lastPos)); lastPos = src.length(); } else { sb.append(src.substring(lastPos, pos)); lastPos = pos; } } return sb.toString(); } }