Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2002-01-21
16:44 • Ticket [505694ffff] binay scan can't work correctly status still Closed ... artifact: 5567d5a4f9 user: dkf
2002-01-20
09:10 • Closed ticket [505694ffff]. artifact: 38f2159ae6 user: hobbs
2002-01-19
07:43 • New ticket [505694ffff]. artifact: 2f5933c3cd user: nobody

binay scan can't work correctly

Closed / Invalid505694ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2002-01-19 07:43:33
I want to change a Chinese character, which unicode 
value is \u4e2d, to hex.the following is my commands.

set a \u4e2d
binary scan $a H* b

after I run the two commands, the value of variable b 
is 2d, not 4e2d. who can tell me why? thanks

my email : [email protected]
hobbsplain2002-01-20 09:10:37
Logged In: YES 
user_id=72656

You want "format %x [scan \u4e2d %c]", as is:

(hobbs) 60 % format %x [scan \u4e2d %c]
4e2d

\u4e2d is not binary, it's just a utf-8 string, so use the 
regular scan.
dkfplain2002-01-21 16:44:11
Logged In: YES 
user_id=79902

A better solution is:
  binary scan [encoding convertto unicode $a] H* b
(because that is better at dealing with characters with the
highest bit set.)
Log in (anonymous is fine) to add a comment.