3 public static void main(String
[] args
) throws Throwable
{
4 // Isolated low surrogate.
5 char x
= 56478; // 0xdc9e
6 String xs
= new String(new char[] { x
});
7 // Note that we fix a result for our implementation; but
8 // the JDK does something else.
9 System
.out
.println(xs
.getBytes("UTF-8").length
);
11 // isolated high surrogate -- at end of input stream
13 String ys
= new String(new char[] { y
});
14 // Note that we fix a result for our implementation; but
15 // the JDK does something else.
16 System
.out
.println(ys
.getBytes("UTF-8").length
);