Modify

#3557 closed Bug (No Bug)

Can't concatenate other strings to BinaryToString

Reported by: Relive Owned by:
Milestone: Component: AutoIt
Version: 3.3.14.2 Severity: None
Keywords: binarytostring, string, concatenate Cc:

Description

msgbox(0, '', BinaryToString(0x41) & chr(117)) ; Spells "Au"
msgbox(0, '', Chr(116) & Chr(111) & BinaryToString(0x49) & chr(116)) ; Spells "toIt"
msgbox(0, '', 'Auto' & BinaryToString(0x49) & chr(116)) ; Spells "AutoIt"

Any kind of string concatenation after BinaryToString() is "cut off".

Attachments (0)

Change History (3)

comment:1 by jchd18, on Jun 22, 2017 at 9:34:46 PM

Resolution: No Bug
Status: newclosed

You are misusing the parameter to BinaryToString.

msgbox(0, '', BinaryToString("0x41") & chr(117)) ; Spells "Au"
msgbox(0, '', Chr(116) & Chr(111) & BinaryToString("0x49") & chr(116)) ; Spells "toIt"
msgbox(0, '', 'Auto' & BinaryToString("0x49") & chr(116)) ; Spells "AutoIt"

Please, next time, post in the Help forum before creating a ticket.

comment:2 by Relive, on Jul 1, 2017 at 1:11:09 AM

This ticket may need to be reopened as I may have found a bug in BinaryToString(). Inserting 0x41 and 0x49 to BinaryMid() to extract 1 byte each, which is seemingly redundant, but actually fixed the problem.

msgbox(0, '', BinaryToString(BinaryMid(0x41, 1, 1)) & chr(117)) ; Spells "Au"
msgbox(0, '', Chr(116) & Chr(111) & BinaryToString(BinaryMid(0x49, 1, 1)) & chr(116)) ; Spells "toIt"
msgbox(0, '', 'Auto' & BinaryToString(BinaryMid(0x49, 1, 1)) & chr(116)) ; Spells "AutoIt"

The binary values written this way have hidden padded zeros and BinaryToString() has some parsing bug. In another view, when doing Binary(73), it returns 0x49000000. But I specifically wrote "0x49" in my argument, and thus this ticket was submitted.

comment:3 by jchd18, on Jul 1, 2017 at 4:28:04 PM

No, you submitted BinaryToString(0x49) and not BinaryToString("0x49") as explained in my previous answer.
Please post in the help forum (not here) which "parsing bug" you found in BinaryToString().

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.