From a145d66a174f37e9b69a199835911ca4c280f3d3 Mon Sep 17 00:00:00 2001 From: Ram Viswanadha Date: Tue, 6 Apr 2004 02:34:10 +0000 Subject: [PATCH] ICU-3594 fix USE_STD3_ASCII_RULES X-SVN-Rev: 14879 --- .../com/ibm/icu/dev/test/stringprep/TestIDNA.java | 8 ++++---- icu4j/src/com/ibm/icu/text/IDNA.java | 12 +++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/icu4j/src/com/ibm/icu/dev/test/stringprep/TestIDNA.java b/icu4j/src/com/ibm/icu/dev/test/stringprep/TestIDNA.java index ef695941a72..4473decac94 100644 --- a/icu4j/src/com/ibm/icu/dev/test/stringprep/TestIDNA.java +++ b/icu4j/src/com/ibm/icu/dev/test/stringprep/TestIDNA.java @@ -31,8 +31,8 @@ public class TestIDNA extends TestFmwk { // test StringBuffer toUnicode doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNA.DEFAULT, null); doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNA.ALLOW_UNASSIGNED, null); - //doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNA.USE_STD3_RULES, null); - //doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNA.USE_STD3_RULES|IDNA.ALLOW_UNASSIGNED, null); + doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNA.USE_STD3_RULES, null); + doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNA.USE_STD3_RULES|IDNA.ALLOW_UNASSIGNED, null); } } @@ -42,8 +42,8 @@ public class TestIDNA extends TestFmwk { // test StringBuffer toUnicode doTestToASCII(new String(TestData.unicodeIn[i]),TestData.asciiIn[i],IDNA.DEFAULT, null); doTestToASCII(new String(TestData.unicodeIn[i]),TestData.asciiIn[i],IDNA.ALLOW_UNASSIGNED, null); - //doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNA.USE_STD3_RULES, null); - //doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNA.USE_STD3_RULES|IDNA.ALLOW_UNASSIGNED, null); + doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNA.USE_STD3_RULES, null); + doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNA.USE_STD3_RULES|IDNA.ALLOW_UNASSIGNED, null); } } diff --git a/icu4j/src/com/ibm/icu/text/IDNA.java b/icu4j/src/com/ibm/icu/text/IDNA.java index b636b89606a..0332604b596 100644 --- a/icu4j/src/com/ibm/icu/text/IDNA.java +++ b/icu4j/src/com/ibm/icu/text/IDNA.java @@ -318,11 +318,10 @@ public final class IDNA { char ch=processOut.charAt(j); if(ch > 0x7F){ srcIsASCII = false; - } - // here we do not assemble surrogates - // since we know that LDH code points - // are in the ASCII range only - if(isLDHChar(ch)==false){ + }else if(isLDHChar(ch)==false){ + // here we do not assemble surrogates + // since we know that LDH code points + // are in the ASCII range only srcIsLDH = false; failPos = j; } @@ -614,8 +613,7 @@ public final class IDNA { while((ch=src.next())!= UCharacterIterator.DONE){ if(ch>0x7F){ srcIsASCII = false; - } - if((srcIsLDH = isLDHChar(ch))==false){ + }else if((srcIsLDH = isLDHChar(ch))==false){ failPos = src.getIndex(); } }