code: public static String encode(final String str) {
          try {
              return URLEncoder.encode(str, "UTF-8");
          } catch (final Exception e) {
              LOGGER.log(Level.WARN, "Encodes str [" + str + "] failed", e);
  
              return str;
          }
      }
docs: Encodes the specified string.
  
  @param str the specified string
  @return URL encoded string