Overview
| Artifact ID: | afb3da897f09a1f24c57665429ff0a6edca17d7e9508e160be531e660b4587b7 |
|---|---|
| Ticket: | b3fbd9a6e028dfa5c0138a461fdb5b4ae09ffebc
string trim generates invalid utf-8 for some codepoints |
| User & Date: | chelmuth on 2026-01-06 07:18:10 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-plain"
- comment changed to:
The following code produces invalid UTF-8 strings and causes puts to abort. set padded_unicode_22c5 " \U22c5 " set trimmed_unicode_22c5 [string trim $padded_unicode_22c5] puts "padded_unicode_22c5: '$padded_unicode_22c5'" puts "trimmed_unicode_22c5: '$trimmed_unicode_22c5'" The same happens for U+2020. Most interestingly the characters are represented by UTF-8 sequences like follows. U+22C5 0xE2 0x87 0x85 U+2020 0xE2 0x80 0xA0 The first sequence contains 0x85 and the second 0x80. U+0085 (0xC2 0x85) is <Next Line> (NEL). U+0080 (0xC2 0x80) is <Padding Character> (PAD). Both should be trimmed I expect but are not in the string above (0xC2 is missing). I also tested Tcl 9.0.3, which works like a charm.
- foundin changed to: "8.6.17"
- is_private changed to: "0"
- login: "chelmuth"
- priority changed to: "5 Medium"
- private_contact changed to: "7313b123087982208eac04b14054e0c43344d79f"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "chelmuth"
- subsystem changed to: "44. UTF-8 Strings"
- title changed to:
string trim generates invalid utf-8 for some codepoints
- type changed to: "Bug"