Escape/unescape utility class: org.unbescape.html.HtmlEscape
Some sample code (see the javadoc for more detail):
final String escaped = HtmlEscape.escapeHtml5(text);
final String escaped = HtmlEscape.escapeHtml4Xml(text);
final String escaped = HtmlEscape.escapeHtml( text, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_HEXA, HtmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT);
Some sample code (see the javadoc for more detail):
final String unescaped = HtmlEscape.unescapeHtml(text);
Escape/unescape utility class: org.unbescape.xml.XmlEscape
Some sample code (see the javadoc for more detail):
final String escaped = XmlEscape.escapeXml11(text);
final String escaped = XmlEscape.escapeXml10Minimal(text);
final String escaped = XmlEscape.escapeXml11( text, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_DECIMAL, XmlEscapeLevel.LEVEL_3_ALL_NON_ALPHANUMERIC);
Some sample code (see the javadoc for more detail):
final String unescaped = XmlEscape.unescapeXml(text);
Escape/unescape utility class: org.unbescape.javascript.JavaScriptEscape
Some sample code (see the javadoc for more detail):
final String escaped = JavaScriptEscape.escapeJavaScript(text);
final String escaped = JavaScriptEscape.escapeJavaScript( text, JavaScriptEscapeType.SINGLE_ESCAPE_CHARS_DEFAULT_TO_XHEXA_AND_UHEXA, JavaScriptEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET);
Some sample code (see the javadoc for more detail):
final String unescaped = JavaScriptEscape.unescapeJavaScript(text);
Escape/unescape utility class: org.unbescape.json.JsonEscape
Some sample code (see the javadoc for more detail):
final String escaped = JsonEscape.escapeJson(text);
final String escaped = JsonEscape.escapeJson( text, JsonEscapeType.SINGLE_ESCAPE_CHARS_DEFAULT_TO__UHEXA, JsonEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET);
Some sample code (see the javadoc for more detail):
final String unescaped = JsonEscape.unescapeJson(text);
Escape/unescape utility class: org.unbescape.uri.UriEscape
Some sample code (see the javadoc for more detail):
final String escapedPath = UriEscape.escapeUriPath(text);
final String escapedPathSegment = UriEscape.escapeUriPathSegment(text);
final String escapedQueryParam = UriEscape.escapeUriQueryParam(text);
final String escapedFragmentId = UriEscape.escapeUriFragmentId(text);
Some sample code (see the javadoc for more detail):
final String unescapedPath = UriEscape.unescapeUriPath(text);
final String unescapedPathSegment = UriEscape.unescapeUriPathSegment(text);
final String unescapedQueryParam = UriEscape.unescapeUriQueryParam(text);
final String unescapedFragmentId = UriEscape.unescapeUriFragmentId(text);
Escape/unescape utility class: org.unbescape.css.CssEscape
Some sample code (see the javadoc for more detail):
final String escapedIdentifier = CssEscape.escapeCssIdentifier(text);
final String escapedString = CssEscape.escapeCssString(text);
final String escapedIdentifier = CssEscape.escapeCssIdentifier( text, CssIdentifierEscapeType.BACKSLASH_ESCAPES_DEFAULT_TO_SIX_DIGIT_HEXA, CssIdentifierEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET);
final String escapedString = CssEscape.escapeCssString( text, CssStringEscapeType.BACKSLASH_ESCAPES_DEFAULT_TO_COMPACT_HEXA, CssStringEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET);
Some sample code (see the javadoc for more detail):
final String unescaped = CssEscape.unescapeCss(escapedIdentifierOrString);
Escape/unescape utility class: org.unbescape.csv.CsvEscape
Some sample code (see the javadoc for more detail):
final String escaped = CsvEscape.escapeCsv(text);
Some sample code (see the javadoc for more detail):
final String unescaped = CsvEscape.unescapeCsv(text);
Escape/unescape utility class: org.unbescape.java.JavaEscape
Some sample code (see the javadoc for more detail):
final String escaped = JavaEscape.escapeJava(text);
final String escaped = JavaEscape.escapeJava( text, JavaEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET);
Some sample code (see the javadoc for more detail):
final String unescaped = JavaEscape.unescapeJava(escaped);
Escape/unescape utility class: org.unbescape.properties.PropertiesEscape
Some sample code (see the javadoc for more detail):
final String escapedKey = PropertiesEscape.escapePropertiesKey(text);
final String escapedString = PropertiesEscape.escapePropertiesValue(text);
final String escapedKey = PropertiesEscape.escapePropertiesKey( keyText, PropertiesKeyEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET);
final String escapedValue = PropertiesEscape.escapePropertiesValue( valueText, PropertiesValueEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET);
Some sample code (see the javadoc for more detail):
final String unescaped = PropertiesEscape.unescapeProperties(escapedKeyOrValue);