commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r956782 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java
Date Tue, 22 Jun 2010 06:19:29 GMT
Author: bayard
Date: Tue Jun 22 06:19:29 2010
New Revision: 956782

URL: http://svn.apache.org/viewvc?rev=956782&view=rev
Log:
Escaping supplementary chars seems good for NumericEntityEscaper. LANG-617

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java?rev=956782&r1=956781&r2=956782&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/text/translate/NumericEntityEscaper.java
Tue Jun 22 06:19:29 2010
@@ -72,7 +72,6 @@ public class NumericEntityEscaper extend
             }
         }
 
-        // TODO: if (codepoint > 0xffff) ?
         out.write("&#");
         out.write(Integer.toString(codepoint, 10));
         out.write(';');

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java?rev=956782&r1=956781&r2=956782&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java
Tue Jun 22 06:19:29 2010
@@ -47,4 +47,16 @@ public class NumericEntityEscaperTest ex
         String result = nee.translate(input);
         assertEquals("Failed to escape numeric entities via the above method", "ADFGZ",
result);
     }
+
+    // See LANG-617
+    public void testSupplementary() {
+        NumericEntityEscaper nee = new NumericEntityEscaper();
+        String input = "\uD803\uDC22";
+        String expected = "𐰢";
+
+        String result = nee.translate(input);
+        assertEquals("Failed to escape numeric entities supplementary characters", expected,
result);
+
+    }
+
 }



Mime
View raw message