diff options
| author | apnadkarni <apnmbx-wits@yahoo.com> | 2024-08-23 08:10:20 (GMT) |
|---|---|---|
| committer | apnadkarni <apnmbx-wits@yahoo.com> | 2024-08-23 08:10:20 (GMT) |
| commit | d472e9ae5561f7d7f6e8b6b2de6efd6a56fa79ba (patch) | |
| tree | 7fc78279badf58ebccb0490dcf3a0a1950d6ee3b /generic/tclEncoding.c | |
| parent | e3f4e1187fee73ffe66ff7924ed2f09b4db5cc61 (diff) | |
| download | tcl-d472e9ae5561f7d7f6e8b6b2de6efd6a56fa79ba.zip tcl-d472e9ae5561f7d7f6e8b6b2de6efd6a56fa79ba.tar.gz tcl-d472e9ae5561f7d7f6e8b6b2de6efd6a56fa79ba.tar.bz2 | |
Also fix charlimit for cesu-8
Diffstat (limited to 'generic/tclEncoding.c')
| -rw-r--r-- | generic/tclEncoding.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 8af87d3..3f86857 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2469,7 +2469,12 @@ UtfToUtfProc( dstStart = dst; flags |= PTR2INT(clientData); - dstEnd = dst + dstLen - ((flags & ENCODING_UTF) ? TCL_UTF_MAX : 6); + + /* + * If output is UTF-8 or encoding for Tcl's internal encoding, + * max space needed is TCL_UTF_MAX. Otherwise, need 6 bytes (CESU-8) + */ + dstEnd = dst + dstLen - ((flags & (ENCODING_INPUT|ENCODING_UTF)) ? TCL_UTF_MAX : 6); /* * Macro to output an isolated high surrogate when it is not followed |
