Class Encoding


  • public final class Encoding
    extends Object
    Encoders and decoders for HTML.
    • Constructor Detail

      • Encoding

        public Encoding()
    • Method Detail

      • decodeHtml

        public static String decodeHtml​(String s)
        Decodes HTML entities to produce a string containing only valid Unicode scalar values.
        Parameters:
        s - text/html
        Returns:
        text/plain
      • encodeRcdataOnto

        public static void encodeRcdataOnto​(String plainText,
                                            Appendable output)
                                     throws IOException
        Appends an encoded form of plainText to putput where the encoding is sufficient to prevent an HTML parser from transitioning out of the RCDATA state. This is suitable for encoding a text node inside a <textarea> or <title> element outside foreign content.
        Parameters:
        plainText - text/plain
        output - a buffer of text/html that has a well-formed HTML prefix that would leave an HTML parser in the Data state if it were to encounter a space character as the next character. In practice this means that the buffer does not contain partial tags or comments, and the most recently opened element is `