code: private static String rfc3986Conformance(String s) {
          assert s != null;
  
          String out;
  
          if (s == null) {
              return null;
          }
  
          try {
              out = URLEncoder.encode(s, UTF8_CHARSET).replace("+", "%20")
                      .replace("*", "%2A").replace("%7E", "~");
          } catch (UnsupportedEncodingException e) {
              out = s;
          }
          return out;
      }
docs: Based on RFC 3986 and AWS doc, further encode certain characters.