Opened 10 years ago

Last modified 10 years ago

#2626 closed Bug

ControlGetText wrong encoding for some words. — at Version 5

Reported by: anonymous Owned by:
Milestone: 3.3.13.3 Component: AutoIt
Version: 3.3.11.2 Severity: None
Keywords: Cc:

Description (last modified by Jpm)

$gui=GUICreate("", 200, 100)
$id1=GUICtrlCreateCheckbox("Выполнение приложений", 5, 5)
$id2=GUICtrlCreateInput("Включить в группу", 5, 35)
$id3=GUICtrlCreateLabel("Сохранять пропорции", 5, 65)
GUISetState()
ConsoleWrite(ControlGetText($gui, "", GUICtrlGetHandle($id1)) & @LF)
ConsoleWrite(ControlGetText($gui, "", GUICtrlGetHandle($id2)) & @LF)
ConsoleWrite(ControlGetText($gui, "", GUICtrlGetHandle($id3)) & @LF)
Do
Until GUIGetMsg() = -3

In console and in Autoit v3 Windows Info on Visible Text tab the encoding of this text is wrong and show this:

K?>;=5=85
:;NG8BL
!>E@0=OBL

$text = ControlGetText($gui, "", GUICtrlGetHandle($id1)
$array = StringToASCIIArray($text)
array is:
Row|Col 0
[0]|18
[1]|4
[2]|75
[3]|4
[4]|63
[5]|4
[6]|62
[7]|4
[8]|59
[9]|4
[10]|61
[11]|4
[12]|53
[13]|4
[14]|61
[15]|4
[16]|56
[17]|4
[18]|53
[19]|4
[20]|32

But if now change id1 text to Выполнение приложений2 or add a couple of characters of any kind, for example Выполнение приложенийblabla or Выполнение the text begins to determine the correct.

Change History (5)

comment:1 Changed 10 years ago by anonymous

the same is observed in Notepad.exe
If text is exactly Выполнение приложений no extra spaces and line breaks, this script gives an incorrect result:

MsgBox(0, "", ControlGetText("[class:Notepad]", "", "Edit1"))

comment:2 Changed 10 years ago by anonymous

The same example, the text encoding utf-16

Local $atext_1 = [1042,1099,1087,1086,1083,1085,1077,1085,1080,1077,32,1087,1088,1080,1083,1086,1078,1077,1085,1080,1081]
Local $atext_2 = [1042,1082,1083,1102,1095,1080,1090,1100,32,1074,32,1075,1088,1091,1087,1087,1091]
Local $atext_3 = [1057,1086,1093,1088,1072,1085,1103,1090,1100,32,1087,1088,1086,1087,1086,1088,1094,1080,1080]


Local $gui=GUICreate("", 200, 100)
Local $id1=GUICtrlCreateCheckbox(StringFromASCIIArray($atext_1), 5, 5)
Local $id2=GUICtrlCreateInput(StringFromASCIIArray($atext_2), 5, 35)
Local $id3=GUICtrlCreateLabel(StringFromASCIIArray($atext_3), 5, 65)
GUISetState()

ConsoleWrite(ControlGetText($gui, "", GUICtrlGetHandle($id1)) & @LF)
ConsoleWrite(ControlGetText($gui, "", GUICtrlGetHandle($id2)) & @LF)
ConsoleWrite(ControlGetText($gui, "", GUICtrlGetHandle($id3)) & @LF)

Do
Until GUIGetMsg() = -3

comment:3 Changed 10 years ago by anonymous

ControlGetText wrong encoding

WinGetText() wrong encoding too

$gui=GUICreate("Диспетчер устройств", 300, 100)
GUISetState()
MsgBox(0, "", WinGetTitle($gui) & @LF)

comment:4 Changed 10 years ago by anonymous

And WinGetTitle() too (see example above)

comment:5 Changed 10 years ago by Jpm

  • Description modified (diff)

Definitly a bug detection of Unicode string is failing

Note: See TracTickets for help on using tickets.