code: public static String encode(String plain) {
      try {
        return URLEncoder.encode(plain, "UTF-8");
      } catch (UnsupportedEncodingException e) {
        throw new IllegalStateException(
            "Unable to encode URL entry via " + ENCODING_FOR_URL + ". This should not happen", e);
      }
    }
docs: Encodes Java string into {@code x-www-form-urlencoded} format
  
  @param plain input value
  @return encoded value
  @see URLEncoder#encode(String, String)