Strange behaviour observed
I noticed a strange behaviour when sorting lists with text from two different scripts. This post on SO piqued my interest: https://stackoverflow.com/questions/74058262/icu-sort-strings-based-on-2-different-locales.
When using the PyCharm run window, the ASCII characters are sorted first, but when using the terminal the non-ASCII words are sorted first. I couldn't find an explanation myself so asking here.
Here is the code I ran:
from icu import Collator, Locale
mylist = ["abc", "xyz", "pqr", "الفبای", "فارس"]
collator = Collator.createInstance(Locale("fa_IR.UTF-8"))
mylist.sort(key=collator.getSortKey)
print(mylist)
System details: PyICU 2.9, Python 3.11 on Windows 11 (using unofficial builds from https://www.lfd.uci.edu/~gohlke/pythonlibs/)
Thanks in advance!
Edited by Nemphra Ificiana