| Ticket UUID: | 622120 | ||
| Title: | Tcl_UniCharToUtfDString: 2. arg | ||
| Type: | RFE | Created on: | 2002-10-11 22:16:29 |
| Submitter: | pointsman | Assigned to: | hobbs |
| Subsystem: | 44. UTF-8 Strings | Severity: | |
| Priority: | 5 Medium | Last modified: | 2026-11-13 11:18:45 |
| Status: | Closed | Closed by: | serhiy.storchaka |
| Resolution: | Fixed | Closed on: | 2026-11-13 11:18:43 |
| Version: | None | ||
| Description: | ||||
Currently, Tcl_UniCharToUtfDString requires, that the second argument must specify the length of the given Unicode string. Tcl_UtfToUniCharDString, on the other hand, allows -1 as second argument, in which case Tcl_UtfToUniCharDString uses strlen to calculate the length of the UTF string to convert. This behavior feels familiar from Tcl_DStringAppend. Please consider a similar behavior for Tcl_UniCharToUtfDString: -1 as second argument should mean, convert the unicode string to convert up to the first unicode 0 (Tcl_UniCharToUtfDString should use Tcl_UniCharLen by itself internaly, if the second arg is -1). rolf | ||||
| User Comments: | ||||
serhiy.storchaka added on 2026-11-13 11:18:45:
Since Tcl 9.0, a negative length passed to Tcl_UniCharToUtfDString means that the string is converted up to the first null character, as in Tcl_UtfToUniCharDString. | ||||
