code: public static String decode(String s) {
          StringBuffer sb = new StringBuffer();
          for(int i=0; i<s.length(); i++) {
              char c = s.charAt(i);
              switch (c) {
              case '%':
                  try {
                      sb.append((char)Integer.parseInt(
                                                       s.substring(i+1,i+3),16));
                  } catch (NumberFormatException e) {
                      throw new IllegalArgumentException();
                  }
                  i += 2;
                  break;
              default:
                  sb.append(c);
                  break;
              }
          }
          // Undo conversion to external encoding
          String result = sb.toString();
          try {
              byte[] inputBytes = result.getBytes("8859_1");
              result = new String(inputBytes);
          } catch (UnsupportedEncodingException e) {
              // The system should always have 8859_1
          }
          return result;
      }
docs: The function decodes URL-encoded strings into a regular string.
  This function is mostly copied from the Java source code.
  To convert to a <code>String</code>, each character is examined in turn:
  <ul>
  <li>The remaining characters are represented by 3-character
  strings which begin with the percent sign,
  "<code>%<i>xy</i></code>", where <i>xy</i> is the two-digit
  hexadecimal representation of the lower 8-bits of the character.
  </ul>