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
This commit is contained in:
parent
e26303c2f7
commit
dff81d4f4c
4 changed files with 57 additions and 8 deletions
19
libjava/testsuite/libjava.lang/pr27171.java
Normal file
19
libjava/testsuite/libjava.lang/pr27171.java
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
2
libjava/testsuite/libjava.lang/pr27171.out
Normal file
2
libjava/testsuite/libjava.lang/pr27171.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
3
|
||||
3
|
Loading…
Add table
Add a link
Reference in a new issue