Either of escapeEcmaScript or escapeJson would be a suitable replacement.
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-3.0 › org › apache › commons › lang3 › StringEscapeUtils.html
StringEscapeUtils (Commons Lang 3.0 API)
July 19, 2011 - Note that unicode characters greater than 0x7f are as of 3.0, no longer escaped. If you still wish this functionality, you can achieve it via the following: StringEscapeUtils.ESCAPE_XML.with( NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );
Apache Commons
commons.apache.org › proper › commons-text › xref-test › org › apache › commons › text › StringEscapeUtilsTest.html
StringEscapeUtilsTest xref
44 * </p> 45 */ 46 class StringEscapeUtilsTest { 47 private static final String FOO = "foo"; 48 49 private static final String[][] HTML_ESCAPES = { 50 {"no escaping", "plain text", "plain text"}, 51 {"no escaping", "plain text", "plain text"}, 52 {"empty string", "", ""}, 53 {"null", null, null}, 54 {"ampersand", "bread & butter", "bread & butter"}, 55 {"quotes", ""bread" & butter", "\"bread\" & butter"}, 56 {"final character only", "greater than >", "greater than >"}, 57 {"first character only", "< less than", "< less than"}, 58 {"apostrophe", "Huntington's chorea", "H
Apache JIRA
issues.apache.org › jira › browse › LANG-498
[LANG-498] Add StringEscapeUtils.escapeText() methods - ASF Jira
June 30, 2009 - LANG-505 Rewrite StringEscapeUtils · Closed · Assignee: Unassigned · Reporter: Henning Schmiedehausen · Votes: 0 Vote for this issue · Watchers: 0 Start watching this issue · Created: 28/Apr/09 00:15 · Updated: 17/Dec/09 03:41 ·
Apache Commons
commons.apache.org › proper › commons-lang › apidocs › org › apache › commons › lang3 › StringEscapeUtils.html
StringEscapeUtils (Apache Commons Lang 3.21.0-SNAPSHOT API)
Note that Unicode characters greater than 0x7f are as of 3.0, no longer escaped. If you still wish this functionality, you can achieve it via the following: StringEscapeUtils.ESCAPE_XML.with( NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE));
Apache Commons
commons.apache.org › proper › commons-text › javadocs › api-release › org › apache › commons › text › StringEscapeUtils.html
StringEscapeUtils (Apache Commons Text 1.9 API)
public static StringEscapeUtils.Builder builder(CharSequenceTranslator translator)
Groovy
docs.groovy-lang.org › latest › html › api › groovy › json › StringEscapeUtils.html
StringEscapeUtils (Groovy 5.0.4)
StringEscapeUtils instances should NOT be constructed in standard programming.
Java Tips
javatips.net › api › org.apache.commons.lang.stringescapeutils
Java Examples for org.apache.commons.lang.StringEscapeUtils
* </p> * * @param string * the String to escape, may be null * @return a new escaped String, null if null string input */ public static String escapeEnml(final String string, final int tabWidth) { if (StringUtil.isNull(string)) { return string; } String escapedXml = StringEscapeUtils.escapeXml10(string); escapedXml = escapedXml.replaceAll(StringUtils.SPACE, Constants.HTML_NBSP); escapedXml = escapedXml.replaceAll(ConstantsUtil.TAB, StringUtils.repeat(Constants.HTML_NBSP, tabWidth)); return escapedXml; }
GitHub
github.com › apache › commons-text › blob › master › src › main › java › org › apache › commons › text › StringEscapeUtils.java
commons-text/src/main/java/org/apache/commons/text/StringEscapeUtils.java at master · apache/commons-text
public static StringEscapeUtils.Builder builder(final CharSequenceTranslator translator) { return new Builder(translator); } · /** * Returns a {@code String} value for a CSV column enclosed in double quotes, if required. * * <p> * If the value contains a comma, newline or double quote, then the String value is returned enclosed in double quotes.
Author apache
Javadoc.io
javadoc.io › static › commons-lang › commons-lang › 2.5 › org › apache › commons › lang › StringEscapeUtils.html
StringEscapeUtils (Commons Lang 2.5 API)
statement.executeQuery("SELECT * FROM MOVIES WHERE TITLE='" + StringEscapeUtils.escapeSql("McHale's Navy") + "'");
GitHub
github.com › ervandew › formic › blob › main › src › java › org › apache › commons › lang › StringEscapeUtils.java
formic/src/java/org/apache/commons/lang/StringEscapeUtils.java at main · ervandew/formic
Framework for building cross platform installers which utilize ant as the core engine. - formic/src/java/org/apache/commons/lang/StringEscapeUtils.java at main · ervandew/formic
Author ervandew
Apache Commons
commons.apache.org › proper › commons-lang › apidocs › src-html › org › apache › commons › lang3 › StringEscapeUtils.html
StringEscapeUtils - Source code - Apache Software Foundation
043 */ 044@Deprecated 045public class StringEscapeUtils { 046 047 /* ESCAPE TRANSLATORS */ 048 049 private static final class CsvEscaper extends CharSequenceTranslator { 050 051 private static final char CSV_DELIMITER = ','; 052 private static final char CSV_QUOTE = '"'; 053 private static final String CSV_QUOTE_STR = String.valueOf(CSV_QUOTE); 054 private static final char[] CSV_SEARCH_CHARS = { CSV_DELIMITER, CSV_QUOTE, CharUtils.CR, CharUtils.LF }; 055 056 @Override 057 public int translate(final CharSequence input, final int index, final Writer out) throws IOException { 058 if (index != 0)
Top answer 1 of 4
152
The class was moved from package
org.apache.commons.
lang3
to
org.apache.commons.text
You can replace the deprecated library easily:
In your build.gradle:
implementation 'org.apache.commons:commons-text:1.11.0'
And in your class using StringEscapeUtils make sure you import the correct class:
import org.apache.commons.text.StringEscapeUtils;
1.11.0 is currently the newest version (last checked February 20th 2024) but you can check the versions at maven: https://mvnrepository.com/artifact/org.apache.commons/commons-text
2 of 4
17
Per the deprecation listing, it was moved to a new project -- commons-text
Codingwithharish
codingwithharish.com › posts › java-stringescapeutils-guide
Complete StringEscapeutils Guide in Java | Coding with Harish
September 3, 2023 - StringEscapeUtils is a part of the Apache Commons Text library and provides a set of static methods for escaping and unescaping strings.
Apache Commons
commons.apache.org › proper › commons-lang › javadocs › api-3.1 › org › apache › commons › lang3 › StringEscapeUtils.html
StringEscapeUtils (Commons Lang 3.1 API)
July 19, 2011 - Note that Unicode characters greater than 0x7f are as of 3.0, no longer escaped. If you still wish this functionality, you can achieve it via the following: StringEscapeUtils.ESCAPE_XML.with( NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );
GitHub
github.com › apache › commons-lang › blob › master › src › main › java › org › apache › commons › lang3 › StringEscapeUtils.java
commons-lang/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java at master · apache/commons-lang
* <a href="https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringEscapeUtils.html"> * StringEscapeUtils</a> instead. */ @Deprecated · public class StringEscapeUtils { · /* ESCAPE TRANSLATORS */ · private static final class CsvEscaper extends CharSequenceTranslator { ·
Author apache
Espertech
esper.espertech.com › release-8.7.0 › javadoc-common › com › espertech › esper › common › internal › util › apachecommonstext › StringEscapeUtils.html
StringEscapeUtils (Esper Common API Documentation)
public static StringEscapeUtils.Builder builder(CharSequenceTranslator translator)
myCompiler
mycompiler.io › view › IiASbxe8AdB
Using Commons Text StringEscapeUtils (Java) - myCompiler
July 20, 2022 - public class helloworld{ public static void main(String[] args) { String strHTMLInput = "TestÖ"; String strUnEscapeHTML = StringEscapeUtils.unescapeHtml3(strHTMLInput); String strUnEscapeHTML4 = StringEscapeUtils.unescapeHtml4(strHTMLInput); System.out.println("Escape : " + StringEsca...
Maven Repository
mvnrepository.com › artifact › org.apache.commons › commons-lang3
Maven Repository: org.apache.commons » commons-lang3
November 12, 2025 - Apache Commons Lang, a package of Java utility classes for the classes that are in java.lang's hierarchy, or are considered to be so standard as to justify existence in java.lang. The code is tested using the latest revision of the JDK for supported LTS releases: 8, 11, 17, 21 and 25 currently ...