code: private static URI createUri(final String txt) {
          URI result;
          try {
              result = new URI(txt);
          } catch (final URISyntaxException ex) {
              final int index = ex.getIndex();
              if (index == -1) {
                  throw new IllegalArgumentException(ex.getMessage(), ex);
              }
              final StringBuilder value = new StringBuilder(txt);
              value.replace(
                  index,
                  index + 1,
                  Href.encode(value.substring(index, index + 1))
              );
              result = Href.createUri(value.toString());
          }
          return result;
      }
docs: Parses the specified content to create the corresponding {@code URI}
  instance. In case of an {@code URISyntaxException}, it will automatically
  encode the character that causes the issue then it will try again
  if it is possible otherwise an {@code IllegalArgumentException} will
  be thrown.
  @param txt The content to parse
  @return The {@code URI} corresponding to the specified content.
  @throws IllegalArgumentException in case the content could not be parsed
  @throws IllegalStateException in case an invalid character could not be
  encoded properly.