Issue with Transliterating Cyrillic Characters Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Loop
Posts: 171
Joined: 07 Jan 2019, 14:51

Issue with Transliterating Cyrillic Characters

Post by Loop » 21 Jan 2024, 13:32

Hey,

Unfortunately, the MsgBox window displays nothing.
Could someone please take a look and let me know what I might be doing wrong?

Thank you in advance for your assistance!

Code: Select all

transliteration := {"а": "a", "б": "b", "в": "v", "г": "g", "д": "d", "е": "e", "ё": "yo", "ж": "zh", "з": "z", "и": "i", "й": "y", "к": "k", "л": "l", "м": "m", "н": "n", "о": "o", "п": "p", "р": "r", "с": "s", "т": "t", "у": "u", "ф": "f", "х": "kh", "ц": "ts", "ч": "ch", "ш": "sh", "щ": "sch", "ъ": """", "ы": "y", "ь": """", "э": "e", "ю": "yu", "я": "ya"}


cyrillic_char := "Ю"
latin_char := transliteration[cyrillic_char] ? transliteration[cyrillic_char] : cyrillic_char
MsgBox % latin_char

Edit: The file is saved in UTF-8 with BOM, some characters work, but not all

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Issue with Transliterating Cyrillic Characters  Topic is solved

Post by mikeyww » 21 Jan 2024, 14:55

It works only if it's in your array.

Code: Select all

#Requires AutoHotkey v1.1.33
transliteration := {"ю": "yu"}
cyrillic_char1  := "Ю"
cyrillic_char2  := "ю"
MsgBox % "1       = " transliteration[cyrillic_char1]   "`n"
       . "2       = " transliteration[cyrillic_char2]   "`n"
       . "Same = "    (cyrillic_char1 = cyrillic_char2)

Loop
Posts: 171
Joined: 07 Jan 2019, 14:51

Re: Issue with Transliterating Cyrillic Characters

Post by Loop » 21 Jan 2024, 15:27

Thank you @mikeyww
Honestly, I don't understand it.
"Ю" is contained in my array.
I don't understand the difference between cyrillic_char1 and cyrillic_char2, they are the same thing, aren't they?

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Issue with Transliterating Cyrillic Characters

Post by mikeyww » 21 Jan 2024, 15:30

If you believe that your character is saved in your array, then do a "Find" in your text editor and see if the character is found. I think that the two characters differ. AHK indicates that the two characters differ. So that is two votes so far. You can cast your vote, but AHK still wins the election!

Code: Select all

#Requires AutoHotkey v1.1.33
transliteration := {"ю": "yu"}
cyrillic_char1  := "Ю"
cyrillic_char2  := "ю"
MsgBox % Asc(cyrillic_char1) "`n"
       . Asc(cyrillic_char2)

Loop
Posts: 171
Joined: 07 Jan 2019, 14:51

Re: Issue with Transliterating Cyrillic Characters

Post by Loop » 21 Jan 2024, 16:04

both my browser (Firefox) and my editor (Notepad) tell me that it is the same character.
This means that the search finds all character :)
But, I believe AHK when it says that there are different characters.
evidence.jpg
evidence.jpg (30.2 KiB) Viewed 353 times

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Issue with Transliterating Cyrillic Characters

Post by mikeyww » 21 Jan 2024, 20:43

OK. I do not know why the programs handle them differently, but at least you have a solution now.

User avatar
flyingDman
Posts: 2848
Joined: 29 Sep 2013, 19:01

Re: Issue with Transliterating Cyrillic Characters

Post by flyingDman » 21 Jan 2024, 20:58

They are visibly different characters in Scite as well.

Code: Select all

msgbox % ("Ю" = "ю")
14.3 & 1.3.7

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Issue with Transliterating Cyrillic Characters

Post by mikeyww » 21 Jan 2024, 21:00

It seems like Notepad might treat these as variants or cases of the same letter, but AHK does not. Perhaps that is how AHK works with this language or various languages.

Post Reply

Return to “Ask for Help (v1)”