snippets

Check-in [4afcc3a70a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:drop ^@ in return values
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4afcc3a70a3901633583e1538b4862341648d86d0dda04d5ebff00f1f01dcba5
User & Date: alex 2018-08-15 13:12:17
Context
2018-08-15
13:19
added some old dde snippets from Jun 2007 check-in: c9723faeb5 user: alex tags: trunk
13:12
drop ^@ in return values check-in: 4afcc3a70a user: alex tags: trunk
2018-08-14
12:38
unicode chars to hex check-in: 2f25603654 user: alex tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to misc/unicodecharstohex.tcl.

3
4
5
6
7
8
9
10
11
12
13
14
  foreach {a b c d} [split [binary encode hex [encoding convertto unicode $txt]] {}] {
    if {[expr 0x${c}${d}${a}${b}] <= 0x7f} {
      append new [binary decode hex ${c}${d}${a}${b}]
    } else {
      append new \\u $c $d $a $b
    }
  }
  return $new
}

puts [UnicodeCharsToHex \u65B0\u7D30\u660E\u9AD4]
puts [UnicodeCharsToHex Arbeitsbl├Ątter]







|




3
4
5
6
7
8
9
10
11
12
13
14
  foreach {a b c d} [split [binary encode hex [encoding convertto unicode $txt]] {}] {
    if {[expr 0x${c}${d}${a}${b}] <= 0x7f} {
      append new [binary decode hex ${c}${d}${a}${b}]
    } else {
      append new \\u $c $d $a $b
    }
  }
  return [string map {\0 {}} $new]
}

puts [UnicodeCharsToHex \u65B0\u7D30\u660E\u9AD4]
puts [UnicodeCharsToHex Arbeitsbl├Ątter]