diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-03 13:05:38 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-03 13:05:38 (GMT) |
commit | b488f3edf6ee202281aca13745c0d4212310f654 (patch) | |
tree | 068d3d40fef160ee211303889016729e228b15ec /generic/tclParse.c | |
parent | 9a1c1f5e11679feeaafd9c788631fc98faf6945e (diff) | |
download | tcl-b488f3edf6ee202281aca13745c0d4212310f654.zip tcl-b488f3edf6ee202281aca13745c0d4212310f654.tar.gz tcl-b488f3edf6ee202281aca13745c0d4212310f654.tar.bz2 |
TIP #619 implementation. tests not working yet
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r-- | generic/tclParse.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c index 614401f..fdd1478 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -869,6 +869,7 @@ TclParseBackslash( * No hexdigits -> This is just "u". */ result = 'u'; +#if TCL_UTF_MAX < 4 } else if (((result & 0xFC00) == 0xD800) && (count == 6) && (p[5] == '\\') && (p[6] == 'u') && (numBytes >= 10)) { /* If high surrogate is immediately followed by a low surrogate @@ -879,6 +880,7 @@ TclParseBackslash( result = ((result & 0x3FF)<<10 | (low & 0x3FF)) + 0x10000; count += count2 + 2; } +#endif } break; case 'U': @@ -888,9 +890,6 @@ TclParseBackslash( * No hexdigits -> This is just "U". */ result = 'U'; - } else if ((result | 0x7FF) == 0xDFFF) { - /* Upper or lower surrogate, not allowed in this syntax. */ - result = 0xFFFD; } break; case '\n': @@ -954,10 +953,12 @@ TclParseBackslash( *readPtr = count; } count = Tcl_UniCharToUtf(result, dst); +#if TCL_UTF_MAX < 4 if ((result >= 0xD800) && (count < 3)) { /* Special case for handling high surrogates. */ count += Tcl_UniCharToUtf(-1, dst + count); } +#endif return count; } |