333481 Handle UTF-32 codepoints

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2632 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-01-07 12:03:15 +00:00
parent c21b9383b0
commit 8bd319093f
5 changed files with 37 additions and 3 deletions

View File

@ -8,6 +8,7 @@ jetty-7.3.0-SNAPSHOT
+ 332796 Annotations inheritance does not work with jetty7
+ 332937 Added Destroyable interface and reworked dependent lifecycles, specially of JNDI
+ 320457 add SPNEGO support
+ 333481 Handle UTF-32 codepoints
+ 333679 Refactored jetty-jmx. Moved mbeans to modules.
jetty-7.2.2.v20101205 5 December 2010

View File

@ -126,7 +126,7 @@ public class Utf8StringBuffer
// 10xxxxxx
_bits=(_bits<<6)|(b&0x3f);
if (--_more==0)
_buffer.append((char)_bits);
_buffer.append(Character.toChars(_bits));
}
}
}

View File

@ -123,7 +123,10 @@ public class Utf8StringBuilder
// 10xxxxxx
_bits=(_bits<<6)|(b&0x3f);
if (--_more==0)
_buffer.append((char)_bits);
{
// _buffer.append((char)_bits);
_buffer.append(Character.toChars(_bits));
}
}
}
}

View File

@ -69,5 +69,19 @@ public class Utf8StringBufferTest
assertEquals("abc?",buffer.toString());
}
@Test
public void testUTF32codes()
throws Exception
{
String source="\uD842\uDF9F";
byte[] bytes=source.getBytes("UTF-8");
String jvmcheck = new String(bytes,0,bytes.length,"UTF-8");
assertEquals(source,jvmcheck);
Utf8StringBuffer buffer = new Utf8StringBuffer();
buffer.append(bytes,0,bytes.length);
String result=buffer.toString();
assertEquals(source,result);
}
}

View File

@ -68,7 +68,23 @@ public class Utf8StringBuilderTest
buffer.append(bytes[i]);
assertEquals("abc?",buffer.toString());
}
@Test
public void testUTF32codes()
throws Exception
{
String source="\uD842\uDF9F";
byte[] bytes=source.getBytes("UTF-8");
String jvmcheck = new String(bytes,0,bytes.length,"UTF-8");
assertEquals(source,jvmcheck);
Utf8StringBuilder buffer = new Utf8StringBuilder();
buffer.append(bytes,0,bytes.length);
String result=buffer.toString();
assertEquals(source,result);
}
}