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.
Diacritics in v2
Re: Diacritics in v2
It works here.
Did you save the v2 script with UTF-8 encoding?
Did you save the v2 script with UTF-8 encoding?
-
- Posts: 3
- Joined: 30 Mar 2023, 16:34
Re: Diacritics in v2
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.
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.
Re: Diacritics in v2
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
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.
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
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.
-
- Posts: 3
- Joined: 30 Mar 2023, 16:34
Re: Diacritics in v2
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 !!
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 !!
Re: Diacritics in v2
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.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!