Example usage for org.apache.commons.lang3.text.translate EntityArrays BASIC_UNESCAPE

List of usage examples for org.apache.commons.lang3.text.translate EntityArrays BASIC_UNESCAPE

Introduction

In this page you can find the example usage for org.apache.commons.lang3.text.translate EntityArrays BASIC_UNESCAPE.

Prototype

String[][] BASIC_UNESCAPE

To view the source code for org.apache.commons.lang3.text.translate EntityArrays BASIC_UNESCAPE.

Click Source Link

Usage

From source file:cc.clabs.stratosphere.mlp.utils.StringUtils.java

/**
 * Unescapes special entity char sequences like < to its UTF-8 representation.
 * All ISO-8859-1, HTML4 and Basic entities will be translated.
 * /*from   w w w .  j  a va2s . c  o  m*/
 * @param text the text that will be unescaped
 * @return the unescaped version of the string text
 */
public static String unescapeEntities(String text) {
    CharSequenceTranslator iso = new LookupTranslator(EntityArrays.ISO8859_1_UNESCAPE());
    CharSequenceTranslator basic = new LookupTranslator(EntityArrays.BASIC_UNESCAPE());
    CharSequenceTranslator html4 = new LookupTranslator(EntityArrays.HTML40_EXTENDED_UNESCAPE());
    return html4.translate(iso.translate(basic.translate(text)));
}

From source file:org.wikipedia.citolytics.cpa.utils.StringUtils.java

/**
 * Unescapes special entity char sequences like < to its UTF-8 representation.
 * All ISO-8859-1, HTML4 and Basic entities will be translated.
 *
 * @param text the text that will be unescaped
 * @return the unescaped version of the string text
 *//*from   w  w w.ja  v  a  2 s  .  co  m*/
public static String unescapeEntities(String text) {
    CharSequenceTranslator iso = new LookupTranslator(EntityArrays.ISO8859_1_UNESCAPE());
    CharSequenceTranslator basic = new LookupTranslator(EntityArrays.BASIC_UNESCAPE());
    //CharSequenceTranslator html4 = new LookupTranslator(EntityArrays.HTML40_EXTENDED_UNESCAPE());
    return StringEscapeUtils.unescapeHtml4(iso.translate(basic.translate(text)));
}