Hi there,
I want to extract from any given text a list of words that contain the letter “Åž” or “ÅŸ”, in order to replace these with “Ș” and “È™” respectively. (Explanation: MS shipped Windows XP with wrong diacriticals for the Romanian keyboard layout – to be more exact, they put the Turkish s with cedilla instead of s with comma. As a result the vast majority of Romanian text written today has the wrong diacriticals – and MS also gave us “t with cedilla” instead of “t with comma”)
I want to automate this replacement with an AppleScript, BUT trouble is I want to avoid replacing the letter “ÅŸ” in any turkish words that could happen along (not terribly probable, but still…)
So… I made a long list of turkish words to ignore (about 1940), but I can’ get AppleScript to ignore case when I use the “if i is not in turkishWordList”
Here’s the script:
set turkishWordList to {"abaÅŸo", "acarlaÅŸma", "ÅŸehrazat"} -- <-- much shorter list of Turkish words
set txtBlock to "Abaşo abaşo aşa acarlaşma acarlaŞma şehrazat Şehrazat" -- the only Romanian word here is "așa"
set wlBrut to words of txtBlock
set wordList to {}
repeat with i in wlBrut
ignoring case
if (i as string) contains "ÅŸ" then
if (i as string) is not in turkishWordList then
set wordList to wordList & i
end if
end if
end ignoring
end repeat
The variable wordList should contain only one word – “aÅŸa”. Instead, the script considers that “acarlaÅžma” is not in turkishWordList, although I placed the if statement inside “ignoring case/end ignoring case” conditionals. The same situation goes with Åžehrazat…
Curiously, the Turkish word “AbaÅŸo” is not included. What am I doing wrong?