snippets

Check-in [2f25603654]
Login

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

Overview
Comment:unicode chars to hex
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2f25603654b1a68a70eb86be3db33c5b92ebaf06b27e34ed4e1cbf57e9538b47
User & Date: alex 2018-08-14 12:38:46
Context
2018-08-15
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
2017-10-28
11:36
sunrise sunset check-in: 454c7baebb user: alex tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added misc/unicodecharstohex.tcl.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
proc UnicodeCharsToHex { txt } {
  set new {}
  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]