From 7d1613ac75f237ba9375c3cf93b2755f8f193402 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 1 Apr 2023 07:27:28 +0000 Subject: Improve tcltest package: Don't use 'scan' for printable characters, and don't print lf as \x0A any more (as in Tcl 8.6) --- library/tcltest/tcltest.tcl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 278a4e0..6a161a3 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -1152,15 +1152,14 @@ proc tcltest::SafeFetch {n1 n2 op} { proc tcltest::Asciify {s} { set print "" foreach c [split $s ""] { - set i [scan $c %c] - if {[string is print $c] && ($i <= 127)} { + if {[string is print $c] && (($c <= "\x7E") || ($c == "\n"))} { append print $c - } elseif {$i <= 0xFF} { - append print \\x[format %02X $i] - } elseif {$i <= 0xFFFF} { - append print \\u[format %04X $i] + } elseif {$c <= "\xFF"} { + append print \\x[format %02X [scan $c %c]] + } elseif {$c <= "\xFFFF"} { + append print \\u[format %04X [scan $c %c]] } else { - append print \\U[format %08X $i] + append print \\U[format %08X [scan $c %c]] } } return $print -- cgit v0.12