|
2005-12-16
| ||
| 18:10 | • Closed ticket [1363452fff]: binary scan unicode error plus 2 other changes artifact: 05719ca29d user: dkf | |
|
2005-11-29
| ||
| 20:15 | • Ticket [1363452fff]: 5 changes artifact: 4293adcd5a user: dkf | |
|
2005-11-22
| ||
| 06:15 | • New ticket [1363452fff]. artifact: ba3b33f06f user: nyademo | |
binary scan unicode error
Closed / Invalid1363452fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-11-22 06:15:58
Windows2000/ActiveTcl8.4.11
test
=========================================
set b1 \u3042\u3044
set b2 [encoding convertto unicode $b1]
binary scan $b1 H* result1;# 4244
binary scan $b2 H* result2;# 42304430
if {$result1 ne $result2} {error error}
maybe is result2 value right?
It seems to me that each second bytes was lost.
dkfplain2005-11-29 20:15:15
Logged In: YES user_id=79902 That's exactly the way it is defined to work, using just the low byte from each character. The [encoding convertto] just transforms the characters into a sequence of bytes (with each resulting byte encoded in a single character in the range \u0000-\u00ff) which are then handled in the way you describe. The key point is that Tcl is using a different interpretation of bytes and (especially) characters to what you expected. Keeping bug open while I consider if a documentation update is needed.
dkf Closed ticket [1363452fff].
[History diff]2005-12-16 18:10:38
Log in (anonymous is fine) to add a comment.