Modify

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#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 Changed 8 years ago by jchd18

  • Resolution set to No Bug
  • Status changed from new to closed

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 Changed 7 years ago by Relive

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 Changed 7 years ago by jchd18

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().

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.