code: public static String encodePercentage(char c) {
      if (isAlphanumeric(c)) return ("" + c);
      if (c < 16) return ("%0" + Integer.toHexString(c).toUpperCase());
      if (c < 128) return ("%" + Integer.toHexString(c).toUpperCase());
      String s = encodeUTF8(c);
      String result = "";
      for (int i = 0; i < s.length(); i++) {
        result += "%" + Integer.toHexString(s.charAt(i)).toUpperCase();
      }
      return (result);
    }
docs: Encodes a character to an Percentage code (if necessary).
  If the character is greater than 0x80, the character is converted to
  a UTF8-sequence and this sequence is encoded as percentage codes.