diff options
| author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-08 17:35:32 +0000 |
|---|---|---|
| committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-08 17:35:32 +0000 |
| commit | 4e9cb5a379ed29db3a449b899249151eb0691444 (patch) | |
| tree | 4e56c11527f3021de4681a3fb9c9570949a66080 /libjava/gnu/gcj/convert/Input_UTF8.java | |
| parent | cac50a9f0f3190238caca507d72751654473e55c (diff) | |
| download | ppe42-gcc-4e9cb5a379ed29db3a449b899249151eb0691444.tar.gz ppe42-gcc-4e9cb5a379ed29db3a449b899249151eb0691444.zip | |
* gnu/gcj/convert/Input_UTF8.java (read): Fixed handling of
surrogate characters.
* gnu/gcj/convert/Output_UTF8.java (standardUTF8): Default to
true.
(write): Correct handling of surrogate characters.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35569 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/gcj/convert/Input_UTF8.java')
| -rw-r--r-- | libjava/gnu/gcj/convert/Input_UTF8.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libjava/gnu/gcj/convert/Input_UTF8.java b/libjava/gnu/gcj/convert/Input_UTF8.java index f76f282e406..433a0d1e3a6 100644 --- a/libjava/gnu/gcj/convert/Input_UTF8.java +++ b/libjava/gnu/gcj/convert/Input_UTF8.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 1999, 2000 Free Software Foundation This file is part of libgcj. @@ -56,10 +56,11 @@ public class Input_UTF8 extends BytesToUnicode // partial == (hi-0xD800)*0x10+((lo-0xDC00)>>6)+0x400. // The definition lo>=0xDC00 && lo<=0xDFFF implies // that (lo-0xDC00)>>6 is in the range 0..15. - // Hence we can infer (partial-0x400)>>4 == (hi-0xDB00) - // and we can emit the high-surrogate without waiting - // for the final byte: - outbuffer[outpos++] = (char) (0xDA00+(partial>>4)); + // Hence we can solve for `hi' and we can emit + // the high-surrogate without waiting for the + // final byte: + outbuffer[outpos++] + = (char) (0xD800 + ((partial - 0x400) >> 4)); // Now we want to set it up so that when we read // the final byte on the next iteration, we will |

