code: @SuppressWarnings("unchecked")
      private String encodeAttribute(String s, Charset charset) throws ErrorDataEncoderException {
          if (s == null) {
              return "";
          }
          try {
              String encoded = URLEncoder.encode(s, charset.name());
              if (encoderMode == EncoderMode.RFC3986) {
                  for (Map.Entry<Pattern, String> entry : percentEncodings) {
                      String replacement = entry.getValue();
                      encoded = entry.getKey().matcher(encoded).replaceAll(replacement);
                  }
              }
              return encoded;
          } catch (UnsupportedEncodingException e) {
              throw new ErrorDataEncoderException(charset.name(), e);
          }
      }
docs: Encode one attribute
  
  @return the encoded attribute
  @throws ErrorDataEncoderException
  if the encoding is in error