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 : dimblue@163.net
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.
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.)