Modify

Opened 10 years ago

Closed 6 years ago

#2688 closed Bug (No Bug)

StringToBinary + ConsoleWrite

Reported by: grass.dennis@… Owned by:
Milestone: Component: AutoIt
Version: 3.3.10.2 Severity: None
Keywords: Cc:

Description

ConsoleWrite-Output is the same as written in StringToBinary if & @LF is not used.

Code to test:

$b = StringToBinary("test")

ConsoleWrite("=== Binary Test ===" & @LF & @LF)
ConsoleWrite("Binary with LF:" & @LF)
ConsoleWrite($b & @LF)
ConsoleWrite("Just Binary:" & @LF)
ConsoleWrite($b)
ConsoleWrite(@LF) ;Übersicht
ConsoleWrite("Binary with empty string:" & @LF)
ConsoleWrite($b & "")
ConsoleWrite(@LF) ;Übersicht
ConsoleWrite("=== === ==== === ===" & @LF)

Attachments (0)

Change History (8)

comment:1 Changed 10 years ago by Jpm

I don't fully understand as the output for me is

>Running:(3.3.10.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "F:\AdmMesnage\_Data\Desktop\#2688 StringToBinary-ConsoleWrite.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
=== Binary Test ===

Binary with LF:
0x74657374
Just Binary:
test
Binary with empty string:
0x74657374
=== === ==== === ===
+>19:13:43 AutoIt3.exe ended.rc:0

comment:2 Changed 10 years ago by mlipok

whether it should not be like this:

>Running:(3.3.10.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "F:\AdmMesnage\_Data\Desktop\#2688 StringToBinary-ConsoleWrite.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
=== Binary Test ===

Binary with LF:
0x74657374
Just Binary:
0x74657374
Binary with empty string:
0x74657374
=== === ==== === ===
+>19:13:43 AutoIt3.exe ended.rc:0

focus on:
Just Binary:
0x74657374

comment:3 Changed 10 years ago by BrewManNH

If you add a MsgBox($b) it displays correctly, consolewrite shows the error/bug. I compiled this to a CUI app, and the Windows console shows the same error, so that eliminates anything happening inside SciTE from being an issue.

comment:4 Changed 10 years ago by Jpm

I still miss the point when running Under SciTE
the binary string does not change if nothing added which is good from my point of view

comment:5 Changed 10 years ago by BrewManNH

It's not correct because if you do a consolewrite of just the variable "ConsoleWrite($b)", that is supposed to hold the string in binary form, with nothing else after it, the binary displays as the original text and not the binary that is supposed to be in there. So instead of displaying 0x74657374 it displays the word test. If you do ConsoleWrite($b & @CRLF) it displays 0x74657374 which is correct.

comment:6 Changed 10 years ago by Jpm

The concatanation of a string to a binary force a conversion of the binary to a readable string that the reason of the hex value.
That the way of the concatanation works.

Consolewrite by itself does not convert any variable, certainly the string representation of the variable is displayed in this case the binary is a valid string representation.

You can find examples where for instance string containing chr(0) will display the beginning of the string the concatanation does not seems to work in this case

Not sure Jon wants to fix this behavior as consolwrite can be used to send "data" to specific capturing program.

comment:7 Changed 10 years ago by jchd18

Consolewrite by itself does not convert any variable


Yes it does! Or rather: there is no consistency at all in the way various variants "print" themselves thru the method invoked by ConsoleWrite:

  • all strings are "converted" (i.e. emasculated) to ANSI, which is terribly wrong for a program claiming to be Unicode-aware. UTF-8 should be the default here.
  • integers, doubles, some keywords (True, False, Default) and pointers are consolewritten as strings,
  • Null and functions consolewrite nothing at all,
  • Binary spills verbatim.
Local $test = [35, 3.5, (1=1), MsgBox, Default, Null, Ptr(0x12345678), Binary(0x12345678), "100 €", ]

For $v In $test
	ConsoleWrite($v)
	ConsoleWrite(@LF)
Next

comment:8 Changed 6 years ago by Jpm

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

Forget to close

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.