Class HTMLEncoder

java.lang.Object
org.webpki.util.HTMLEncoder

public class HTMLEncoder extends Object
The HTMLEncoder class contains a utility method for converting a string into a format suitable for placing inside a HTML tag parameter, sometimes known as "html encoding".

To convert a String, each character is examined in turn:

  • < is converted into &lt;
  • > is converted into &gt;
  • & is converted into &amp;
  • " is converted into &#034;
  • ' is converted into &#039;
  • All other characters remain the same.
  • Constructor Details

    • HTMLEncoder

      public HTMLEncoder()
  • Method Details

    • encode

      public static String encode(String val)
      Converts a string into a htmlencoded string.
      Parameters:
      val - the String to be converted.
      Returns:
      the converted String.
    • encodeWithLineBreaks

      public static String encodeWithLineBreaks(byte[] val)