From Newsgroup: comp.lang.tcl
Am 25.08.26 um 09:30 schrieb meshparts:
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
--- Synchronet 3.22a-Linux NewsLink 1.2