diff options
author | Tom Tromey <tromey@redhat.com> | 2006-04-17 21:41:47 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2006-04-17 21:41:47 +0000 |
commit | dff81d4f4cf9c3dd98c8e72da0f63799a6620abf (patch) | |
tree | 5f0e83a1d9485d115be3948513876390201dac34 /libjava/testsuite/libjava.lang/pr27171.java | |
parent | e26303c2f718f8b5dec468efdf49e0d50e31e813 (diff) | |
download | gcc-dff81d4f4cf9c3dd98c8e72da0f63799a6620abf.zip gcc-dff81d4f4cf9c3dd98c8e72da0f63799a6620abf.tar.gz gcc-dff81d4f4cf9c3dd98c8e72da0f63799a6620abf.tar.bz2 |
re PR libgcj/27171 (UTF8 PrintWriter goes haywire)
PR libgcj/27171:
* testsuite/libjava.lang/pr27171.java: New file.
* testsuite/libjava.lang/pr27171.out: New file.
* gnu/gcj/convert/Output_UTF8.java (havePendingBytes): Return
true if we've seen a high surrogate.
(write): Handle high surrogates at the end of the stream.
Properly emit isolated low surrogates.
From-SVN: r113013
Diffstat (limited to 'libjava/testsuite/libjava.lang/pr27171.java')
-rw-r--r-- | libjava/testsuite/libjava.lang/pr27171.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.lang/pr27171.java b/libjava/testsuite/libjava.lang/pr27171.java new file mode 100644 index 0000000..a07fea7 --- /dev/null +++ b/libjava/testsuite/libjava.lang/pr27171.java @@ -0,0 +1,19 @@ +public class pr27171 { + + public static void main(String[] args) throws Throwable { + // Isolated low surrogate. + char x = 56478; // 0xdc9e + String xs = new String(new char[] { x }); + // Note that we fix a result for our implementation; but + // the JDK does something else. + System.out.println(xs.getBytes("UTF-8").length); + + // isolated high surrogate -- at end of input stream + char y = 0xdaee; + String ys = new String(new char[] { y }); + // Note that we fix a result for our implementation; but + // the JDK does something else. + System.out.println(ys.getBytes("UTF-8").length); + } +} + |