Ansi VS Unicode

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Ansi VS Unicode

22 May 2018, 15:18

The code below retrieves all networks that have been connected to the computer since windows was installed.
I install Ansi Autohotkey and compile and a user in Sweden gets this...notice the ?? network names.
https://www.dropbox.com/s/jm8500soxijw7ks/Ansi.PNG?dl=0

When install Unicode Autohotkey and compile the user in Sweden gets this...
https://www.dropbox.com/s/806qj9j9uqj7g ... e.PNG?dl=0

How can I get this to display the network names properly?
thanks
DataLife

Code: Select all

OnMessage(0x115, "OnScroll") ; WM_VSCROLL 
OnMessage(0x114, "OnScroll") ; WM_HSCROLL

for INetwork in ComObjCreate("{DCB00C01-570F-4A9B-8D69-199FDBA5723B}").GetNetworks(1)
 tempvarAN := INetwork.GetName() 

count = 0
NetworkName := ""
for INetwork in ComObjCreate("{DCB00C01-570F-4A9B-8D69-199FDBA5723B}").GetNetworks(3) 
 {
  NetworkName := INetwork.GetName()
  count++
  NetworkList = %NetworkList%`n%NetworkName%
 } 

sort, networklist,cl
 
Gui 1: default
Gui 1: add, text, ,%count% Networks were found.
Gui 1: add, text,,You are connected to (%tempvaran%)
gui 1: add, text, , SCROLL DOWN IF NECESSARY`n
Gui 1: add, text,,%NetworkList%
Gui 1: show, autosize, All Known Networks (Wired and Wireless)
return

GuiClose:
ExitApp

GuiSize:
UpdateScrollBars(A_Gui, A_GuiWidth, A_GuiHeight)
return

UpdateScrollBars(GuiNum, GuiWidth, GuiHeight) ;lexikos
 {
  static SIF_RANGE=0x1, SIF_PAGE=0x2, SIF_DISABLENOSCROLL=0x8, SB_HORZ=0, SB_VERT=1
  Gui, %GuiNum%:Default
  Gui, +LastFound
 ; Calculate scrolling area.
  Left := Top := 9999
  Right := Bottom := 0
  WinGet, ControlList, ControlList
  Loop, Parse, ControlList, `n
   {
    GuiControlGet, c, Pos, %A_LoopField%
    if (cX < Left)
     Left := cX
    if (cY < Top)
     Top := cY
    if (cX + cW > Right)
     Right := cX + cW
    if (cY + cH > Bottom)
     Bottom := cY + cH
   }
  Left -= 8
  Top -= 8
  Right += 8
  Bottom += 8
  ScrollWidth := Right-Left
  ScrollHeight := Bottom-Top
 
  ; Initialize SCROLLINFO.
  VarSetCapacity(si, 28, 0)
  NumPut(28, si) ; cbSize
  NumPut(SIF_RANGE | SIF_PAGE, si, 4) ; fMask
  ; Update horizontal scroll bar.
  NumPut(ScrollWidth, si, 12) ; nMax
  NumPut(GuiWidth, si, 16) ; nPage
  DllCall("SetScrollInfo", "uint", WinExist(), "uint", SB_HORZ, "uint", &si, "int", 1)
  
  ; Update vertical scroll bar.
  ; NumPut(SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL, si, 4) ; fMask
  NumPut(ScrollHeight, si, 12) ; nMax
  NumPut(GuiHeight, si, 16) ; nPage
  DllCall("SetScrollInfo", "uint", WinExist(), "uint", SB_VERT, "uint", &si, "int", 1)
  if (Left < 0 && Right < GuiWidth)
   x := Abs(Left) > GuiWidth-Right ? GuiWidth-Right : Abs(Left)
  if (Top < 0 && Bottom < GuiHeight)
   y := Abs(Top) > GuiHeight-Bottom ? GuiHeight-Bottom : Abs(Top)
  if (x || y)
   DllCall("ScrollWindow", "uint", WinExist(), "int", x, "int", y, "uint", 0, "uint", 0)
 }
OnScroll(wParam, lParam, msg, hwnd)
 {
  static SIF_ALL=0x17, SCROLL_STEP=10
  bar := msg=0x115 ; SB_HORZ=0, SB_VERT=1
  VarSetCapacity(si, 28, 0)
  NumPut(28, si) ; cbSize
  NumPut(SIF_ALL, si, 4) ; fMask
  if !DllCall("GetScrollInfo", "uint", hwnd, "int", bar, "uint", &si)
   Return
  VarSetCapacity(rect, 16)
  DllCall("GetClientRect", "uint", hwnd, "uint", &rect)
  new_pos := NumGet(si, 20) ; nPos
  action := wParam & 0xFFFF
  if action = 0 ; SB_LINEUP
   new_pos -= SCROLL_STEP
  else if action = 1 ; SB_LINEDOWN
   new_pos += SCROLL_STEP
  else if action = 2 ; SB_PAGEUP
   new_pos -= NumGet(rect, 12, "int") - SCROLL_STEP
  else if action = 3 ; SB_PAGEDOWN
   new_pos += NumGet(rect, 12, "int") - SCROLL_STEP
  else if action = 5 ; SB_THUMBTRACK
   new_pos := NumGet(si, 24, "int") ; nTrackPos
  else if action = 6 ; SB_TOP
   new_pos := NumGet(si, 8, "int") ; nMin
  else if action = 7 ; SB_BOTTOM
   new_pos := NumGet(si, 12, "int") ; nMax
  else
   Return
  min := NumGet(si, 8, "int") ; nMin
  max := NumGet(si, 12, "int") - NumGet(si, 16) ; nMax-nPage
  new_pos := new_pos > max ? max : new_pos
  new_pos := new_pos < min ? min : new_pos
  old_pos := NumGet(si, 20, "int") ; nPos
  x := y := 0
  if bar = 0 ; SB_HORZ
   x := old_pos-new_pos
  else
   y := old_pos-new_pos
  
  ; Scroll contents of window and invalidate uncovered area.
  DllCall("ScrollWindow", "uint", hwnd, "int", x, "int", y, "uint", 0, "uint", 0)
  
  ; Update scroll bar.
  NumPut(new_pos, si, 20, "int") ; nPos
  DllCall("SetScrollInfo", "uint", hwnd, "int", bar, "uint", &si, "int", 1)
 }
return
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Ansi VS Unicode

22 May 2018, 17:55

Sweet Class ID :D!!!

I'm not 100% how but I'm thinking setting the encoding for the returned pointer may be what you're after.

Code: Select all

	ptr := INetwork.GetName()
	NetworkName := StrGet( &ptr, StrLen( ptr ), "UTF-16" )
Again this is just a guess but I wasn't able to find a comparable encoding property on MSDN

If you don't mind me asking, what header did you find that Class ID in? Thanks ;)

edit: After doing some more research, I don't think that using the pointer will work... It seems like it has to do with how the script is compiled..
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Ansi VS Unicode

22 May 2018, 19:40

TLM wrote:Sweet Class ID :D!!!

I'm not 100% how but I'm thinking setting the encoding for the returned pointer may be what you're after.

Code: Select all

	ptr := INetwork.GetName()
	NetworkName := StrGet( &ptr, StrLen( ptr ), "UTF-16" )
Again this is just a guess but I wasn't able to find a comparable encoding property on MSDN

If you don't mind me asking, what header did you find that Class ID in? Thanks ;)

edit: After doing some more research, I don't think that using the pointer will work... It seems like it has to do with how the script is compiled..
I got the code from HotKeyIt from https://autohotkey.com/boards/viewtopic ... 316#p77824

If the issue is how it is compiled, do you have any suggestions? I use Ahk2Exe.exe. The properties for Ahk2Exe.exe say the file version is 1.1.28.2 and the product version is 1.1.28.02 - Size 838 KB
Ahk2Exe.exe is located in C:\Program Files\AutoHotkey\Compiler

thanks
DataLife
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Ansi VS Unicode

22 May 2018, 19:49

:think: I've been trying to reproduce the issue on different AHk installations and systems but I always get the correct encoding regardless :eh:
I was thinking maybe the Transform command but then that's not available in Unicode ... Anyway i'll report back if I get it to `not` work lol
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Ansi VS Unicode

22 May 2018, 19:58

TLM wrote::think: I've been trying to reproduce the issue on different AHk installations and systems but I always get the correct encoding regardless :eh:
I was thinking maybe the Transform command but then that's not available in Unicode ... Anyway i'll report back if I get it to `not` work lol
I always get the correct output also. The issue happens with the user in Sweden.

I read somewhere that I can create another windows account on my computer and change the language to Swedish. I could have this code on the desktop that way I can find it easily for testing to see if I can reproduce the issue.
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Ansi VS Unicode

26 May 2018, 13:06

@TLM
In my research I found this.... https://autohotkey.com/board/topic/1594 ... ntry103569

It mentions Ansi2Unicode and Unicode2Ansi. I do not understand any of it. Could this fix the display issue?

As I said before this only happens when the end user in Sweden runs the compiled script in the first post. He is not an Authokey user.
So I am not able to experiment to find out how to use Ansi2Unicode and know if my experimentation is correctly coded or if it is correctly coded if it works in Sweden. Once I come up with an attempt to fix the display issue I send the compiled script to the end user for testing.

thanks
Robert
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Ansi VS Unicode

26 May 2018, 14:56

Perhaps but I started thinking maybe you need to make an API call to a language function that would switch it over ( and back if necessary ) for your script.
I'd try both ( or any other possible solution ).. BTW Switching TO Swedish didn't result in the same output for me :/ ...
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Ansi VS Unicode

26 May 2018, 17:30

I do not know how to make an API call. Is it something that can be learned easily? What is the skill level dealing with API? Easy, Medium, Hard. I will do some research on "API call to a language function" to see what I find.
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Ansi VS Unicode

27 May 2018, 12:58

DllCall() to a windows api function can have a steep learning curve but It's ok as there's usually an existing library for such things ;)
Try this one: Default Keyboard Lang
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Ansi VS Unicode

09 Jun 2018, 05:20

I still have not found a solution to this issue.

The code below retrieves all networks that have been connected to the computer since windows was installed.
I installed Ansi Autohotkey and compiled and a user in Sweden gets this...notice the ?? network names.
https://www.dropbox.com/s/jm8500soxijw7ks/Ansi.PNG?dl=0

When install Unicode Autohotkey and compile the user in Sweden gets this...
https://www.dropbox.com/s/806qj9j9uqj7g ... e.PNG?dl=0

One suggestion was making an API call. At the moment that is above my coding skill.

Does anyone know of another way to get a list of all networks that Windows has connected previously?

thanks
Robert

Code: Select all

OnMessage(0x115, "OnScroll") ; WM_VSCROLL 
OnMessage(0x114, "OnScroll") ; WM_HSCROLL

for INetwork in ComObjCreate("{DCB00C01-570F-4A9B-8D69-199FDBA5723B}").GetNetworks(1)
 tempvarAN := INetwork.GetName() 

count = 0
NetworkName := ""
for INetwork in ComObjCreate("{DCB00C01-570F-4A9B-8D69-199FDBA5723B}").GetNetworks(3) 
 {
  NetworkName := INetwork.GetName()
  count++
  NetworkList = %NetworkList%`n%NetworkName%
 } 

sort, networklist,cl
 
Gui 1: default
Gui 1: add, text, ,%count% Networks were found.
Gui 1: add, text,,You are connected to (%tempvaran%)
gui 1: add, text, , SCROLL DOWN IF NECESSARY`n
Gui 1: add, text,,%NetworkList%
Gui 1: show, autosize, All Known Networks (Wired and Wireless)
return

GuiClose:
ExitApp

GuiSize:
UpdateScrollBars(A_Gui, A_GuiWidth, A_GuiHeight)
return

UpdateScrollBars(GuiNum, GuiWidth, GuiHeight) ;lexikos
 {
  static SIF_RANGE=0x1, SIF_PAGE=0x2, SIF_DISABLENOSCROLL=0x8, SB_HORZ=0, SB_VERT=1
  Gui, %GuiNum%:Default
  Gui, +LastFound
 ; Calculate scrolling area.
  Left := Top := 9999
  Right := Bottom := 0
  WinGet, ControlList, ControlList
  Loop, Parse, ControlList, `n
   {
    GuiControlGet, c, Pos, %A_LoopField%
    if (cX < Left)
     Left := cX
    if (cY < Top)
     Top := cY
    if (cX + cW > Right)
     Right := cX + cW
    if (cY + cH > Bottom)
     Bottom := cY + cH
   }
  Left -= 8
  Top -= 8
  Right += 8
  Bottom += 8
  ScrollWidth := Right-Left
  ScrollHeight := Bottom-Top
 
  ; Initialize SCROLLINFO.
  VarSetCapacity(si, 28, 0)
  NumPut(28, si) ; cbSize
  NumPut(SIF_RANGE | SIF_PAGE, si, 4) ; fMask
  ; Update horizontal scroll bar.
  NumPut(ScrollWidth, si, 12) ; nMax
  NumPut(GuiWidth, si, 16) ; nPage
  DllCall("SetScrollInfo", "uint", WinExist(), "uint", SB_HORZ, "uint", &si, "int", 1)
  
  ; Update vertical scroll bar.
  ; NumPut(SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL, si, 4) ; fMask
  NumPut(ScrollHeight, si, 12) ; nMax
  NumPut(GuiHeight, si, 16) ; nPage
  DllCall("SetScrollInfo", "uint", WinExist(), "uint", SB_VERT, "uint", &si, "int", 1)
  if (Left < 0 && Right < GuiWidth)
   x := Abs(Left) > GuiWidth-Right ? GuiWidth-Right : Abs(Left)
  if (Top < 0 && Bottom < GuiHeight)
   y := Abs(Top) > GuiHeight-Bottom ? GuiHeight-Bottom : Abs(Top)
  if (x || y)
   DllCall("ScrollWindow", "uint", WinExist(), "int", x, "int", y, "uint", 0, "uint", 0)
 }
OnScroll(wParam, lParam, msg, hwnd)
 {
  static SIF_ALL=0x17, SCROLL_STEP=10
  bar := msg=0x115 ; SB_HORZ=0, SB_VERT=1
  VarSetCapacity(si, 28, 0)
  NumPut(28, si) ; cbSize
  NumPut(SIF_ALL, si, 4) ; fMask
  if !DllCall("GetScrollInfo", "uint", hwnd, "int", bar, "uint", &si)
   Return
  VarSetCapacity(rect, 16)
  DllCall("GetClientRect", "uint", hwnd, "uint", &rect)
  new_pos := NumGet(si, 20) ; nPos
  action := wParam & 0xFFFF
  if action = 0 ; SB_LINEUP
   new_pos -= SCROLL_STEP
  else if action = 1 ; SB_LINEDOWN
   new_pos += SCROLL_STEP
  else if action = 2 ; SB_PAGEUP
   new_pos -= NumGet(rect, 12, "int") - SCROLL_STEP
  else if action = 3 ; SB_PAGEDOWN
   new_pos += NumGet(rect, 12, "int") - SCROLL_STEP
  else if action = 5 ; SB_THUMBTRACK
   new_pos := NumGet(si, 24, "int") ; nTrackPos
  else if action = 6 ; SB_TOP
   new_pos := NumGet(si, 8, "int") ; nMin
  else if action = 7 ; SB_BOTTOM
   new_pos := NumGet(si, 12, "int") ; nMax
  else
   Return
  min := NumGet(si, 8, "int") ; nMin
  max := NumGet(si, 12, "int") - NumGet(si, 16) ; nMax-nPage
  new_pos := new_pos > max ? max : new_pos
  new_pos := new_pos < min ? min : new_pos
  old_pos := NumGet(si, 20, "int") ; nPos
  x := y := 0
  if bar = 0 ; SB_HORZ
   x := old_pos-new_pos
  else
   y := old_pos-new_pos
  
  ; Scroll contents of window and invalidate uncovered area.
  DllCall("ScrollWindow", "uint", hwnd, "int", x, "int", y, "uint", 0, "uint", 0)
  
  ; Update scroll bar.
  NumPut(new_pos, si, 20, "int") ; nPos
  DllCall("SetScrollInfo", "uint", hwnd, "int", bar, "uint", &si, "int", 1)
 }
return
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Ansi VS Unicode

09 Jun 2018, 05:26

Did you try this?
[COM] How to enumerate IEnumNetworkConnections in a more "native" way? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 27#p220527
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Ansi VS Unicode

10 Jun 2018, 12:34

I completely overlooked your reply on the other thread. I will try that when I get home later today.
Thanks
Datalife
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Ansi VS Unicode

10 Jun 2018, 18:38

I was not sure if this issue was a display issue or an issue retrieving network names. That is why this issue is being covered on this thread and at https://autohotkey.com/boards/viewtopic ... 26#p223226

I now believe the issue is a display issue.

I have always used Ansi 32bit and Scite4Autohotkey.

When I compiled my code as Unicode all I did was install the Unicode version of AutoHotkey and then compile. Should I have saved my script as Unicode or UTF8 before compiling with the Unicode version of Autohotkey?
thanks
Datalife
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Ansi VS Unicode

11 Jun 2018, 03:02

DataLife wrote:When I compiled my code as Unicode all I did was install the Unicode version of AutoHotkey and then compile. Should I have saved my script as Unicode or UTF8 before compiling with the Unicode version of Autohotkey?
Unicode AHK requires UTF-8 files that have a BOM.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Ansi VS Unicode

13 Jun 2018, 11:03

I had my user in Sweden exports his Network Profiles from the registry. It appears to be Korean Profile names and descriptions. Google translate detected it as Korean but could not translate to english.

Is this an issue with his computer not be able to display Korean characters?

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\{001B17B2-6C6C-4391-A28C-013F4A1FEAFF}]
"ProfileName"="癠뷝Ȉ"
"Description"="癠뷝Ȉ"
"Managed"=dword:00000000
"Category"=dword:00000000
"DateCreated"=hex:e2,07,01,00,02,00,02,00,0d,00,29,00,0b,00,b6,01
"NameType"=dword:000000f3
"DateLastConnected"=hex:e2,07,01,00,02,00,02,00,0d,00,29,00,0b,00,b6,01

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\{003CDB71-2C3F-40B5-B86A-F2F53B08CB3A}]
"ProfileName"="궛翽"
"Description"="궛翽"
"Managed"=dword:00000000
"Category"=dword:00000000
"DateCreated"=hex:e1,07,0c,00,05,00,16,00,12,00,2f,00,3b,00,7d,01
"NameType"=dword:000000f3
"DateLastConnected"=hex:e1,07,0c,00,01,00,19,00,0a,00,2f,00,07,00,ee,02

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\{0047625E-F0C1-4EA1-B3F6-53529F78BCD0}]
"ProfileName"="ᓀ㶞ʶ"
"Description"="ᓀ㶞ʶ"
"Managed"=dword:00000000
"Category"=dword:00000000
"DateCreated"=hex:e2,07,02,00,02,00,0d,00,0d,00,19,00,2b,00,2b,01
"NameType"=dword:000000f3
"DateLastConnected"=hex:e2,07,02,00,02,00,0d,00,0d,00,19,00,2b,00,2e,01
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Ansi VS Unicode

13 Jun 2018, 13:22

ahh I see you're making progress..
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Ansi VS Unicode

13 Jun 2018, 16:34

TLM wrote:ahh I see you're making progress..
The code rather it was Ansi or Unicode was working properly. I just did not figure out it was displaying Korean.

This guy bought his computer from Dell and he has no connections to Korea.

Why is there Korean language in his registry? Any Ideas?
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Ansi VS Unicode

14 Jun 2018, 02:15

The registry entries contain dates and times stored as SYSTEMTIME structures:

Code: Select all

typedef struct _SYSTEMTIME {
  WORD wYear;
  WORD wMonth;
  WORD wDayOfWeek;
  WORD wDay;
  WORD wHour;
  WORD wMinute;
  WORD wSecond;
  WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;
That might provide a hint.

1. Entry ("癠뷝Ȉ"):

Code: Select all

"DateCreated"=hex:e2,07,01,00,02,00,02,00,0d,00,29,00,0b,00,b6,01
07E2|0001|0002|0002|000D|0029|000B|01B6
2018|01  |02  |02  |13  |41  |11  |438

2018-01-02 13:41:11
2. Entry ("궛翽"):

Code: Select all

"DateCreated"=hex:e1,07,0c,00,05,00,16,00,12,00,2f,00,3b,00,7d,01
07E1|000C|0005|0016|0012|002F|003B|017D
2017|12  |05  |16  |18  |47  |59  |381

2017-12-16 18:47:59
User avatar
DataLife
Posts: 445
Joined: 29 Sep 2013, 19:52

Re: Ansi VS Unicode

14 Jun 2018, 06:44

Google translate detects some of them as Korean and some as Chinese but could not translate to English. I may post a request for someone from China or Korea to confirm that this Chinese or Korean.

My user in Sweden has gone on vacation for 2 weeks so I can not ask him about the dates until then.
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: Ansi VS Unicode

14 Jun 2018, 20:04

I think just me is hinting that it is not Korean text, but other binary data which coincides with the bit patterns normally used to encode Korean text.
Masonjar13 wrote:Unicode AHK requires UTF-8 files that have a BOM.
Unicode and ANSI versions of AutoHotkey have exactly the same requirements for script file encoding; UTF-8 is recommended, but not required by either version. How the file must be encoded depends on the textual data (source code) of the script, not the version of the executable. All current AutoHotkey versions accept text files ...
  • containing only ASCII source code, with neither UTF-8 nor other non-ASCII characters.
  • encoded as UTF-8 with BOM.
  • encoded as UTF-8 without BOM - or any other codepage - provided that the correct codepage is specified on the command line.
  • encoded as ANSI (specifically, the system's current ANSI codepage) when no BOM is present and no codepage is specified on the command line.
I think the same is true for the current version of Ahk2Exe. Each source file may have a different encoding, as Ahk2Exe automatically converts the source code to UTF-8 for embedding in the compiled script exe.

If the file worked with the ANSI version of AutoHotkey (i.e. characters in the source code were read/decoded correctly), then it should be read correctly by the Unicode version of AutoHotkey, without any changes. If there are issues or differences in behaviour, it is not due to how the script source file is encoded.

However, a file which works with the Unicode version might not work with the ANSI version; not because of the file encoding, but because the source code contains characters which cannot be represented in the current ANSI code page.

COM methods such as INetwork.GetName() always return strings as BSTR (UTF-16 preceded by the string's length). The text part of the BSTR is either retrieved as-is (as UTF-16), or automatically converted to ANSI (in ANSI versions of AutoHotkey). For ANSI versions, any characters which cannot be represented in the current ANSI code page are replaced with '?', and the original characters cannot be retrieved because the data is not present in the string the script receives.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: wilkster and 143 guests