Recently I have come across the following article: Powershell comparison operators [...]
It basically states that
"Peter" -gt "Paul"
evaluates to TRUE
because both strings are compared character by character, and as soon as a character differs, the string which contains the character with the higher ASCII value is considered to be greater than the other one.
I have verified (by testing a fairly large amount of examples) that this is true, and have understood how it works.
However, I now would like to know how this works with non-ASCII characters, especially with strings which only consist of one single character. For example,
'δΊ' -gt 'ζ'
evaluates to FALSE
, but I have no clue why. Please note that I don't know a single Chinese letter or word; I just have opened a website which contained a few Chinese characters, have randomly chosen two of them, and have pasted them into the Powershell console. I have chosen Chinese characters because they are neither in the ASCII nor in the extended ASCII range, and are encoded by at least two bytes in any encoding I am aware of.
How does Powershell compare such characters and strings? By Unicode code points? By ordering according to the current user's locale's rules? By the literal byte values in the binary representation of the encoded string? In the latter case, what is the default encoding?
Microsoft's documentation does not tell anything about it.