public static String unEscapeURL ( String src ) { StringBuffer bf = new StringBuffer ( ) ; char [ ] s = src . toCharArray ( ) ; for ( int k = 0 ; k < s . length ; ++ k ) { char c = s [ k ] ; if ( c == ' ' ) { if ( k + 2 >= s . length ) { bf . append ( c ) ; continue ; } int a0 = PRTokeniser . getHex ( s [ k + 1 ] ) ; int a1 = PRTokeniser . getHex ( s [ k + 2 ] ) ; if ( a0 < 0 || a1 < 0 ) { bf . append ( c ) ; continue ; } bf . append ( ( char ) ( a0 * 16 + a1 ) ) ; k += 2 ; } else bf . append ( c ) ; } return bf . toString ( ) ; }
Unescapes an URL . All the %xx are replaced by the xx hex char value .