[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PATCH: broken handling of alternate separators in java
From: |
Stephane Mikaty |
Subject: |
PATCH: broken handling of alternate separators in java |
Date: |
Tue, 14 Nov 2006 10:15:29 +0100 |
Test case included. Please review and let me know if you need anything else.
diff -Naur old/java/gnu/inet/encoding/IDNA.java new/java/gnu/inet/encoding/IDNA.java
--- old/java/gnu/inet/encoding/IDNA.java 2005-05-26 16:39:52.000000000 +0200
+++ new/java/gnu/inet/encoding/IDNA.java 2006-11-14 10:11:57.795375000 +0100
@@ -46,7 +46,7 @@
char c = input.charAt(i);
if (c == '.' || c == '\u3002' || c == '\uff0e' || c == '\uff61') {
o.append(toASCII(h.toString(), false, true));
- o.append(c);
+ o.append('.');
h = new StringBuffer();
} else {
h.append(c);
diff -Naur old/java/misc/IDNATest.java new/java/misc/IDNATest.java
--- old/java/misc/IDNATest.java 1970-01-01 01:00:00.000000000 +0100
+++ new/java/misc/IDNATest.java 2006-11-14 10:00:39.099500000 +0100
@@ -0,0 +1,16 @@
+import gnu.inet.encoding.*;
+
+public class IDNATest {
+
+ public static void main( String[] args ) throws Exception {
+ String[] tests = new String[] {
+ "domain\u3002invalid",
+ "domain\uFF0Einvalid",
+ "domain\uFF61invalid",
+ };
+ for ( String test : tests ) {
+ assert IDNA.toASCII( test ).equals( "domain.invalid" );
+ }
+ }
+
+}
- PATCH: broken handling of alternate separators in java,
Stephane Mikaty <=