summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-07-03 14:09:23 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-07-03 14:09:23 (GMT)
commit6416a20fd8e2a665f23a1df31e0881b7a91185d4 (patch)
treebf80590238b81e5e084447a56ea8bc4286d2c948
parent77c8868be4772aedccdcfa9fef6c7cc5c8c236d3 (diff)
downloadtcl-6416a20fd8e2a665f23a1df31e0881b7a91185d4.zip
tcl-6416a20fd8e2a665f23a1df31e0881b7a91185d4.tar.gz
tcl-6416a20fd8e2a665f23a1df31e0881b7a91185d4.tar.bz2
Adapt tcltest::Asciify, so it's usable for Tcl 8.5 and 8.6 too
-rw-r--r--library/tcltest/tcltest.tcl10
1 files changed, 6 insertions, 4 deletions
diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl
index ff3f250..c7aee29 100644
--- a/library/tcltest/tcltest.tcl
+++ b/library/tcltest/tcltest.tcl
@@ -29,6 +29,7 @@ namespace eval tcltest {
# yourself. You don't need tcltest to wrap it for you.
variable version [package provide Tcl]
variable patchLevel [info patchlevel]
+ variable fullutf [package vsatisfies $version 8.7-]
##### Export the public tcltest procs; several categories
#
@@ -1150,16 +1151,17 @@ proc tcltest::SafeFetch {n1 n2 op} {
# None.
proc tcltest::Asciify {s} {
+ variable fullutf
set print ""
foreach c [split $s ""] {
if {[string is print $c] && (($c <= "\x7E") || ($c == "\n"))} {
append print $c
- } elseif {$c <= "\xFF"} {
+ } elseif {$c < "\u0100"} {
append print \\x[format %02X [scan $c %c]]
- } elseif {$c <= "\xFFFF"} {
- append print \\u[format %04X [scan $c %c]]
- } else {
+ } elseif {$fullutf && ($c >= "\U10000")} {
append print \\U[format %08X [scan $c %c]]
+ } else {
+ append print \\u[format %04X [scan $c %c]]
}
}
return $print