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:
parent
c21b9383b0
commit
8bd319093f
|
@ -8,6 +8,7 @@ jetty-7.3.0-SNAPSHOT
|
||||||
+ 332796 Annotations inheritance does not work with jetty7
|
+ 332796 Annotations inheritance does not work with jetty7
|
||||||
+ 332937 Added Destroyable interface and reworked dependent lifecycles, specially of JNDI
|
+ 332937 Added Destroyable interface and reworked dependent lifecycles, specially of JNDI
|
||||||
+ 320457 add SPNEGO support
|
+ 320457 add SPNEGO support
|
||||||
|
+ 333481 Handle UTF-32 codepoints
|
||||||
+ 333679 Refactored jetty-jmx. Moved mbeans to modules.
|
+ 333679 Refactored jetty-jmx. Moved mbeans to modules.
|
||||||
|
|
||||||
jetty-7.2.2.v20101205 5 December 2010
|
jetty-7.2.2.v20101205 5 December 2010
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class Utf8StringBuffer
|
||||||
// 10xxxxxx
|
// 10xxxxxx
|
||||||
_bits=(_bits<<6)|(b&0x3f);
|
_bits=(_bits<<6)|(b&0x3f);
|
||||||
if (--_more==0)
|
if (--_more==0)
|
||||||
_buffer.append((char)_bits);
|
_buffer.append(Character.toChars(_bits));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,10 @@ public class Utf8StringBuilder
|
||||||
// 10xxxxxx
|
// 10xxxxxx
|
||||||
_bits=(_bits<<6)|(b&0x3f);
|
_bits=(_bits<<6)|(b&0x3f);
|
||||||
if (--_more==0)
|
if (--_more==0)
|
||||||
_buffer.append((char)_bits);
|
{
|
||||||
|
// _buffer.append((char)_bits);
|
||||||
|
_buffer.append(Character.toChars(_bits));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,5 +69,19 @@ public class Utf8StringBufferTest
|
||||||
assertEquals("abc?",buffer.toString());
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,5 +70,21 @@ public class Utf8StringBuilderTest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue