mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 14:31:31 +00:00
ICU-2906 liberalize escaped surrogate pair handling
X-SVN-Rev: 13343
This commit is contained in:
parent
7fffbdf68f
commit
64c5a40289
1 changed files with 9 additions and 11 deletions
|
@ -5,8 +5,8 @@
|
|||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/impl/Utility.java,v $
|
||||
* $Date: 2003/10/07 17:22:14 $
|
||||
* $Revision: 1.47 $
|
||||
* $Date: 2003/10/07 18:11:01 $
|
||||
* $Revision: 1.48 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
|
@ -803,17 +803,15 @@ public final class Utility {
|
|||
if (result < 0 || result >= 0x110000) {
|
||||
return -1;
|
||||
}
|
||||
// If a 'u' escape sequence (16-bit) specifies a lead
|
||||
// surrogate, see if there is a trail surrogate after it,
|
||||
// either as a 'u' escape or as a literal. If so, join
|
||||
// them up into a supplementary.
|
||||
if (maxDig == 4 && offset < length &&
|
||||
// If an escape sequence specifies a lead surrogate, see
|
||||
// if there is a trail surrogate after it, either as an
|
||||
// escape or as a literal. If so, join them up into a
|
||||
// supplementary.
|
||||
if (offset < length &&
|
||||
UTF16.isLeadSurrogate((char) result)) {
|
||||
c = s.charAt(offset); // [sic] get 16-bit code unit
|
||||
int ahead = offset+1;
|
||||
// ONLY parse backslash 'u', nothing else
|
||||
if (c == '\\' && (offset+1) < length &&
|
||||
s.charAt(offset+1) == 'u') {
|
||||
c = s.charAt(offset); // [sic] get 16-bit code unit
|
||||
if (c == '\\' && ahead < length) {
|
||||
int o[] = new int[] { ahead };
|
||||
c = unescapeAt(s, o);
|
||||
ahead = o[0];
|
||||
|
|
Loading…
Add table
Reference in a new issue