Modify

#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 by J-Paul Mesnage, on Mar 21, 2014 at 6:14:58 PM

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 by mlipok, on Mar 21, 2014 at 9:26:08 PM

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 by BrewManNH, on Mar 22, 2014 at 12:50:58 PM

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 by J-Paul Mesnage, on Mar 22, 2014 at 3:51:23 PM

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 by BrewManNH, on Mar 23, 2014 at 9:18:17 PM

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 by J-Paul Mesnage, on Mar 24, 2014 at 6:57:00 AM

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 by jchd18, on Apr 8, 2014 at 8:48:17 AM

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 by J-Paul Mesnage, on Mar 10, 2018 at 1:52:04 PM

Resolution: No Bug
Status: newclosed

Forget to close

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.