Class Encoder


  • public class Encoder
    extends java.lang.Object
    Various useful encoding methods for working with html
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String _rcsid  
    • Constructor Summary

      Constructors 
      Constructor Description
      Encoder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String attributeEscape​(java.lang.String value)
      Escape a string that's inside an html attribute.
      static java.lang.String attributeJavascriptEscape​(java.lang.String value)
      Escape a string that's inside an html attribute and thence inside javascript.
      static java.lang.String bodyEscape​(java.lang.String value)
      Escape a string that's inside an html body.
      static java.lang.String bodyJavascriptEscape​(java.lang.String value)
      Escape a string that's in an html body (script) area and thence inside javascript.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Encoder

        public Encoder()
    • Method Detail

      • attributeJavascriptEscape

        public static java.lang.String attributeJavascriptEscape​(java.lang.String value)
        Escape a string that's inside an html attribute and thence inside javascript.
        Parameters:
        value - is the input.
        Returns:
        the escaped string.
      • bodyJavascriptEscape

        public static java.lang.String bodyJavascriptEscape​(java.lang.String value)
        Escape a string that's in an html body (script) area and thence inside javascript.
        Parameters:
        value - is the input.
        Returns:
        the escaped string.
      • attributeEscape

        public static java.lang.String attributeEscape​(java.lang.String value)
        Escape a string that's inside an html attribute.
        Parameters:
        value - is the input.
        Returns:
        the escaped string.
      • bodyEscape

        public static java.lang.String bodyEscape​(java.lang.String value)
        Escape a string that's inside an html body.
        Parameters:
        value - is the input.
        Returns:
        the escaped string.