Permalink
Browse files

Tagging RC2

  • Loading branch information...
Henri Yandell
Henri Yandell committed Apr 9, 2011
2 parents 3921c1e + f08d8a2 commit f468dded531a63d25b70f92a112cc38a764bccaa
@@ -502,7 +502,7 @@ public static final String unescapeHtml3(String input) {
* <p>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:
- * {@code StringEscapeUtils.ESCAPE_XML.with( UnicodeEscaper.above(0x7f) );}</p>
+ * {@code StringEscapeUtils.ESCAPE_XML.with( new UnicodeEscaper(Range.between(0x7f, Integer.MAX_VALUE)) );}</p>
*
* @param input the {@code String} to escape, may be null
* @return a new escaped {@code String}, {@code null} if null string input
@@ -22,7 +22,7 @@
<body>
<release version="3.0" date="Unreleased" description="Backwards incompatible update of Commons Lang to Java 5">
- <action type="update" issues="LANG-510">Convert StringUtils API to take CharSequence</action>
+ <action type="update" issues="LANG-687">Convert more of the StringUtils API to take CharSequence</action>
<action type="fix" issue="LANG-685">EqualsBuilder synchronizes on HashCodeBuilder</action>
<action type="fix" issue="LANG-428">StringUtils.isAlpha, isAlphanumeric and isNumeric now return false for ""</action>
<action type="add" issue="LANG-678">Add support for ConcurrentMap.putIfAbsent()</action>
@@ -58,6 +58,7 @@
<action type="fix" issue="LANG-638">NumberUtils createNumber throws a StringIndexOutOfBoundsException when argument containing "e" and "E" is passed in</action>
<!-- 3.0 beta below here -->
<action>NOTE: The below were included in the Commons Lang 3.0-beta release.</action>
+ <action type="update" issues="LANG-510">Convert StringUtils API to take CharSequence</action>
<action type="update">Push down WordUtils to "text" sub-package.</action>
<action type="add" issue="LANG-610">Extend exception handling in ConcurrentUtils to runtime exceptions.</action>
<action type="fix" issue="LANG-608">Some StringUtils methods should take an int character instead of char to use String API features.</action>
@@ -142,11 +142,16 @@ available in the <a href="userguide.html#lang.concurrent.">user guide</a>.</p>
</pre>
<p>Here we see that <code>ESCAPE_XML</code> is a '<code>CharSequenceTranslator</code>', which in turn is made up of two lookup translators based on the basic XML escapes and another to escape apostrophes. This shows one way to combine translators. Another can be shown by looking at the example to achieve the old XML escaping functionality (escaping non-ASCII): </p>
<pre>
- StringEscapeUtils.ESCAPE_XML.with( UnicodeEscaper.above(0x7f) );
+ StringEscapeUtils.ESCAPE_XML.with( new UnicodeEscaper(Range.between(0x7f, Integer.MAX_VALUE) ) );
</pre>
<p>That takes the standard Commons Lang provided escape functionality, and adds on another translation layer. Another JIRA requested option was to also escape non-printable ASCII, this is now achievable with a modification of the above: </p>
<pre>
- StringEscapeUtils.ESCAPE_XML.with( UnicodeEscaper.outsideOf(32, 0x7f) );
+ StringEscapeUtils.ESCAPE_XML.with(
+ new AggregateTranslator(
+ new UnicodeEscaper(Range.between(0, 31)),
+ new UnicodeEscaper(Range.between(0x80, Integer.MAX_VALUE))
+ )
+ )
</pre>
<p>You can also implement your own translators (be they for escaping, unescaping or some aspect of your own). See the <code>CharSequenceTranslator</code> and its <code>CodePointTranslator</code> helper subclass for details - primarily a case of implementing the translate(CharSequence, int, Writer);int method. </p>
</section>

0 comments on commit f468dde

Please sign in to comment.