Overview
| Artifact ID: | ad135c1c6749fbaa913a712b2967971fb5cf5993 |
|---|---|
| Ticket: | 584603ffffffffffffffffffffffffffffffffff
'encoding convertfrom' causes error messages |
| User & Date: | vincentdarley on 2003-09-15 17:40:36 |
Changes
- icomment:
Logged In: YES user_id=32170 I believe the problem is in these lines in tclCmdAH.c: if ((enum options) index == ENC_CONVERTFROM) { /* * Treat the string as binary data. */ string = (char *) Tcl_GetByteArrayFromObj(data, &length); Tcl_ExternalToUtfDString(encoding, string, length, &ds); /* * Note that we cannot use Tcl_DStringResult here because * it will truncate the string at the first null byte. */ The 'Tcl_ExternalToUtfDString' can return an invalid utf string (when used with the identity encoding). I believe that function call should be replaced with a call to the more complex 'Tcl_ExternalToUtf' which is capable of telling us whether the returned string is valid utf or not. We can then take appropriate action for the case where it is invalid utf. According to the comments below, 'appropriate action' appears to mean that we should generate a bytearray instead. - login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"