Diacritics in v2

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
PeterBrown
Posts: 3
Joined: 30 Mar 2023, 16:34

Diacritics in v2

Post by PeterBrown » 30 Mar 2023, 17:33

My son's wife, from Vietnam, is named Hà. To make it easier to type on an English QWERTY keyboard, I've created a hotstring

::Ha::Hà

This works fine in v1, yielding “Hà”. In v2, however, I get “HÔ. Is there a way around this, other than sticking to v1? I don't see syntax differences for hotstrings in the documentation.

gregster
Posts: 9047
Joined: 30 Sep 2013, 06:48

Re: Diacritics in v2

Post by gregster » 30 Mar 2023, 17:39

It works here.
Did you save the v2 script with UTF-8 encoding?

PeterBrown
Posts: 3
Joined: 30 Mar 2023, 16:34

Re: Diacritics in v2

Post by PeterBrown » 31 Mar 2023, 13:51

Well, there must be something different in our procedures (or perhaps in our configurations—I’m running Windows 11 on a Lenovo Ideapad 330).

I restart my computer. There is nothing relevant in my Startup folder. I open “New Standard script.ahk” in Notepad; it contains the line “::Ha::Hà” and, in the bottom margin, “UTF-8”. I close the file. In File Explorer, I right-click on “New Standard script.ahk”, left-click on “Show more options”, and click “Compile script”. A file “New Standard script.exe” appears; the icon is a white H on a green background. I click on it. Back in Notepad, I type “Ha,” this time with a comma; what appears is “Hà,” with a space before the comma. Not what I want. Can anyone advise?

The quotation marks in the preceding paragraph are not anything I entered or saw; I include them only distinguish what I entered or saw from the surrounding text.

gregster
Posts: 9047
Joined: 30 Sep 2013, 06:48

Re: Diacritics in v2

Post by gregster » 31 Mar 2023, 14:06

Still looks a file encoding issue. Can't reproduce it on AHK v2.0.2, though.
Which version are you running? In v2, you can try

Code: Select all

msgbox A_AhkVersion		; with v1, you would get the string 'A_AHKVersion' instead of an actual version number
Actually, there should be no need to compile your script in order to run it. I would test it uncompiled - if it works, you can still compile.

But since ::Ha::Hà is valid code in both v1 and v2, you should also check with which version you compiled the script. Because if you accidentally compiled it as an v1 exe, your script's encoding should have been UTF-8 with BOM to make it work. Without BOM, you will probably see the result you are getting.
(That encoding should also work with v2 - although v2 doesn't need the BOM.)
So my best guess is that you created a v1 exe file without BOM.

PeterBrown
Posts: 3
Joined: 30 Mar 2023, 16:34

Re: Diacritics in v2

Post by PeterBrown » 31 Mar 2023, 16:36

Execute source code ̲w̲it̲h̲o̲u̲t̲ ̲c̲o̲m̲p̲i̲l̲i̲n̲g̲? I retired as a professional programmer in 2003; that was unheard of in my day!

But you’re right; ::Ha::Hà does work if I don’t worry about compiling.

“Send” commands that didn’t work also do ... so far, anyway, including “^e:: Send "̲{Left}"”, which I use for underlining where it’s not otherwise provided for. (In v1 I specified {U+0332} explicitly.)

Many Thanks !!

User avatar
boiler
Posts: 17034
Joined: 21 Dec 2014, 02:44

Re: Diacritics in v2

Post by boiler » 31 Mar 2023, 17:23

PeterBrown wrote: Execute source code ̲w̲it̲h̲o̲u̲t̲ ̲c̲o̲m̲p̲i̲l̲i̲n̲g̲? I retired as a professional programmer in 2003; that was unheard of in my day!
Well, it's an interpreted language, like most implementations of BASIC were back in the day. When AHK is "compiled", there actually is no compiling going on. It just packages the AHK source along with the interpreter binary into an executable file.

Post Reply

Return to “Ask for Help (v2)”