Package com.zfabrik.util.html

## Class Escaper

- java.lang.Object
- - com.zfabrik.util.html.Escaper

-     public class Escaper
      extends java.lang.Object

  Various encoding and decoding utility functions.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Escaper()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static java.lang.String` | `escapeToHTML​(java.lang.String in)` | Escape a string to be used as an HTML String literal
    `static java.lang.String` | `escapeToJS​(java.lang.String in)` | Escape a string to be used as a Javascript String literal.
    `static java.lang.String` | `escapeToJSON​(java.lang.String in)` | Escape a string to be used as a JSON String literal.
    `static java.lang.String` | `urlDecode​(java.lang.String in)` | URL encode/decode This implementation helps addressing two things: As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g.
    `static java.lang.String` | `urlDecode​(java.lang.String in, char esc)` | URL encode/decode This implementation helps addressing two things: As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g.
    `static java.lang.String` | `urlEncode​(java.lang.String in)` | URL encode/decode This implementation helps addressing two things: As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g.
    `static java.lang.String` | `urlEncode​(java.lang.String in, char esc)` | URL encode/decode This implementation helps addressing two things: As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Escaper

          public Escaper()

  - ### Method Detail

    - #### escapeToJSON

          public static java.lang.String escapeToJSON​(java.lang.String in)

      Escape a string to be used as a JSON String literal.

    - #### escapeToJS

          public static java.lang.String escapeToJS​(java.lang.String in)

      Escape a string to be used as a Javascript String literal.

    - #### escapeToHTML

          public static java.lang.String escapeToHTML​(java.lang.String in)

      Escape a string to be used as an HTML String literal

    - #### urlEncode

          public static java.lang.String urlEncode​(java.lang.String in,
                                                   char esc)

      URL encode/decode This implementation helps addressing two things:
      - As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g. "!") rather than "%" as escape character.
      - Using this method, you can spare catching UnsupportedEncodingExceptions, that are never thrown or you'd be in much bigger trouble anyway. This method always uses utf-8 encoding.

    - #### urlEncode

          public static java.lang.String urlEncode​(java.lang.String in)

      URL encode/decode This implementation helps addressing two things:
      - As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g. "!") rather than "%" as escape character.
      - Using this method, you can spare catching UnsupportedEncodingExceptions, that are never thrown or you'd be in much bigger trouble anyway. This method always uses utf-8 encoding.

    - #### urlDecode

          public static java.lang.String urlDecode​(java.lang.String in,
                                                   char esc)

      URL encode/decode This implementation helps addressing two things:
      - As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g. "!") rather than "%" as escape character.
      - Using this method, you can spare catching UnsupportedEncodingExceptions, that are never thrown or you'd be in much bigger trouble anyway. This method always uses utf-8 encoding.

    - #### urlDecode

          public static java.lang.String urlDecode​(java.lang.String in)

      URL encode/decode This implementation helps addressing two things:
      - As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g. "!") rather than "%" as escape character.
      - Using this method, you can spare catching UnsupportedEncodingExceptions, that are never thrown or you'd be in much bigger trouble anyway. This method always uses utf-8 encoding.