On Tcl 9.0.2 I gen an error with md5 function:
::md5::md5 -hex {α=20°}
Error:
expected byte sequence but character 0 was 'α=20°' (U+0003B1)
Can anyone help with this?
Many thanks
Alex
Am 25.08.2026 um 09:07 schrieb meshparts:
On Tcl 9.0.2 I gen an error with md5 function:
::md5::md5 -hex {α=20°}
Error:
expected byte sequence but character 0 was 'α=20°' (U+0003B1)
Can anyone help with this?
Many thanks
Alex
Tcl 8.6.12 works with this example.
Is this a bug in Tcl 9?
Am 25.08.26 um 09:30 schrieb meshparts:Many thanks Christian.
Am 25.08.2026 um 09:07 schrieb meshparts:
On Tcl 9.0.2 I gen an error with md5 function:
::md5::md5 -hex {α=20°}
Error:
expected byte sequence but character 0 was 'α=20°' (U+0003B1)
Can anyone help with this?
Many thanks
Alex
Tcl 8.6.12 works with this example.
Is this a bug in Tcl 9?
No, it is a bug in 8.6.
MD5 works on bytesreams. When you feed it characters outside the byte
range 0x00-0xFF, it is not defined. Most probably you want to encode the string as utf8 via [encoding convertto utf-8 $string].
I believe 8.6 simply cuts off the higher unicode points modulo 0x100 or
the like, which is why the this was changed in 9.0
https://www.magicsplat.com/tcl9/tcl9unicode.html#binary-strings
Christian
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,142 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 92:09:59 |
| Calls: | 14,704 |
| Calls today: | 2 |
| Files: | 186,497 |
| D/L today: |
2,083 files (617M bytes) |
| Messages: | 2,551,639 |