Encode a String using the {@link #FRAGMENT} set of characters.
<p>
Used by URIBuilder to encode the userinfo segment.

@param content the string to encode, does not convert space to '+'
@param charset the charset to use
@return the encoded string
558051
static String encFragment(final String content, final Charset charset) {
		return urlencode(content, charset, FRAGMENT, false);
	}
343757
public static String encodeXMLEntityQuote(final String content) {
		StringBuffer encoded = new StringBuffer(content);
		replaceAll(encoded,"amp","&#38;#38;");
		replaceAll(encoded,"apos","&#39;");
		replaceAll(encoded,"<","&#38;#60;");
		replaceAll(encoded,"gt","&#62;");
		replaceAll(encoded,"quot","&#34;");
		return encoded.toString();
	}
872025
public static String encodeUrlSafe(byte[] source, String charset) {
		return StrUtil.str(encodeUrlSafe(source, false), charset);
	}
1266025
public static String encode(String value, String charsetName) {
        byte[] val = value.getBytes(Charset.forName(charsetName));
        return delegate.encode(val);
    }
1292075
protected String getEncoding(String content) {

        String encoding = content;
        int index = encoding.toLowerCase().indexOf("encoding=\"");
        // encoding attribute found, get the value
        if (index != -1) {
            encoding = encoding.substring(index + 10);
            index = encoding.indexOf("\"");
            if (index != -1) {
                encoding = encoding.substring(0, index);
                return encoding.toUpperCase();
            }
        }
        // no encoding attribute found
        return "";
    }
724562
private String convertOutputToHtml(String content) {

        if (content.length() == 0) {
            return "";
        }
        StringBuilder buffer = new StringBuilder();
        for (String line : content.split("\n")) {
            buffer.append(CmsEncoder.escapeXml(line) + "<br>");
        }
        return buffer.toString();
    }
143798
public static String encode(String value) {
    return encodeReserved(value, FragmentType.URI, Util.UTF_8);
  }
1053589
protected static String decode(String component, String charset)
            throws URIException {
        if (component == null) {
            throw new IllegalArgumentException(
                    "Component array of chars may not be null");
        }
        byte[] rawdata = null;
        //     try {
        rawdata = LaxURLCodec.decodeUrlLoose(EncodingUtil
                .getAsciiBytes(component));
        //     } catch (DecoderException e) {
        //         throw new URIException(e.getMessage());
        //     }
        return EncodingUtil.getString(rawdata, charset);
    }
106905
public static String encodeForm(Parameter<String> query, Charset charset) {
        try {
            return URLEncoder.encode(query.name(), charset.name()) + "=" + URLEncoder.encode(query.value(),
                    charset.name());
        } catch (UnsupportedEncodingException e) {
            // should not happen
            throw new RequestsException(e);
        }
    }
1345649
public static String encode(String value, Charset charset) {
    return encodeReserved(value, FragmentType.URI, charset);
  }
1316069
public XmlStringBuilder element(String name, CharSequence content) {
       return element(name, content.toString());
   }
1106208
static void encPath(final StringBuilder sb, final String content, final Charset charset) {
        urlEncode(sb, content, charset, PATHSAFE, false);
    }
490948
public static String urlDecode(String content, TestContext context) {
        return new UrlDecodeFunction().execute(Collections.singletonList(content), context);
    }
177369
public String data(boolean useUrlencode, String charset) {
        StringBuilder sb = new StringBuilder();
        if (useUrlencode) {
            datas.forEach((k, v) -> sb.append("&").append(k).append("=")
                .append(urlencode(String.valueOf(v), charset)));
        } else {
            datas.forEach((k, v) -> sb.append("&").append(k).append("=").append(String.valueOf(v)));
        }
        return sb.toString().substring(1);
    }
1198690
public static String encode(String value, Charset charset) {
		try {
			return URLEncoder.encode(value, charset.name());
		}
		catch (UnsupportedEncodingException ex) {
			throw new IllegalArgumentException("Characterset is not supported.");
		}
	}
164526
static String encUserInfo(final String content, final Charset charset) {
		return urlencode(content, charset, USERINFO, false);
	}
497456
private static String encodeChunk(String value, FragmentType type, Charset charset) {
    byte[] data = value.getBytes(charset);
    ByteArrayOutputStream encoded = new ByteArrayOutputStream();

    for (byte b : data) {
      if (type.isAllowed(b)) {
        encoded.write(b);
      } else {
        /* percent encode the byte */
        pctEncode(b, encoded);
      }
    }
    return new String(encoded.toByteArray());
  }