protected String decode(String urlString){
  try {
    Class clazz=URLDecoder.class;
    Method method=clazz.getDeclaredMethod("decode",new Class[]{String.class,String.class});
    if (urlString.indexOf('+') >= 0) {
      int len=urlString.length();
      StringBuffer buf=new StringBuffer(len);
      for (int i=0; i < len; i++) {
        char c=urlString.charAt(i);
        if (c == '+')         buf.append("%2B");
 else         buf.append(c);
      }
      urlString=buf.toString();
    }
    Object result=method.invoke(null,new Object[]{urlString,"UTF-8"});
    if (result != null)     return (String)result;
  }
 catch (  Exception e) {
  }
  boolean replaced=false;
  byte[] encodedBytes=urlString.getBytes();
  int encodedLength=encodedBytes.length;
  byte[] decodedBytes=new byte[encodedLength];
  int decodedLength=0;
  for (int i=0; i < encodedLength; i++) {
    byte b=encodedBytes[i];
    if (b == '%') {
      if (i + 2 >= encodedLength)       throw new IllegalArgumentException("Malformed URL (\"" + urlString + "\"): % must be followed by 2 digits.");
      byte enc1=encodedBytes[++i];
      byte enc2=encodedBytes[++i];
      b=(byte)((hexToByte(enc1) << 4) + hexToByte(enc2));
      replaced=true;
    }
    decodedBytes[decodedLength++]=b;
  }
  if (!replaced)   return urlString;
  try {
    return new String(decodedBytes,0,decodedLength,"UTF-8");
  }
 catch (  UnsupportedEncodingException e) {
    return new String(decodedBytes,0,decodedLength);
  }
}

protected String decode ( String urlString ) { try { Class clazz = URLDecoder . class ; Method method = clazz . getDeclaredMethod ( "decode" , new Class [ ] { String . class , String . class } ) ; if ( urlString . indexOf ( '+' ) >= 0 ) { int len = urlString . length ( ) ; StringBuffer buf = new StringBuffer ( len ) ; for ( int i = 0 ; i < len ; i ++ ) { char c = urlString . charAt ( i ) ; if ( c == '+' ) buf . append ( "%2B" ) ; else buf . append ( c ) ; } urlString = buf . toString ( ) ; } Object result = method . invoke ( null , new Object [ ] { urlString , "UTF-8" } ) ; if ( result != null ) return ( String ) result ; } catch ( Exception e ) { } boolean replaced = false ; byte [ ] encodedBytes = urlString . getBytes ( ) ; int encodedLength = encodedBytes . length ; byte [ ] decodedBytes = new byte [ encodedLength ] ; int decodedLength = 0 ; for ( int i = 0 ; i < encodedLength ; i ++ ) { byte b = encodedBytes [ i ] ; if ( b == '%' ) { if ( i + 2 >= encodedLength ) throw new IllegalArgumentException ( "Malformed URL (\"" + urlString + "\"): % must be followed by 2 digits." ) ; byte enc1 = encodedBytes [ ++ i ] ; byte enc2 = encodedBytes [ ++ i ] ; b = ( byte ) ( ( hexToByte ( enc1 ) << 4 ) + hexToByte ( enc2 ) ) ; replaced = true ; } decodedBytes [ decodedLength ++ ] = b ; } if ( ! replaced ) return urlString ; try { return new String ( decodedBytes , 0 , decodedLength , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { return new String ( decodedBytes , 0 , decodedLength ) ; } }
returns a string representation of the given url string . this converts escaped sequences ( % . . ) in the url into the appropriate characters . note : due to class visibility there is a copy of this method in internalbootloader
