I sort a key, but i found the result is not sorted.

127.0.0.1:12301> smembers "\xeb" 1) "\xbb\xec\xb2\xba\xcf" 2) "\xde\x8f\xbd\xda\xb7" 3) "\xc6\xd7\x90\xd4\xd0\xcf\x9f\xd5" 4) "\xc4\xec\xb9\xb1\xfb\xef\x96\xa0\x8b\xd7\x91" 5) "\xd3" 6) "\x8b" 7) "\x88\xe9\x8d" 8) "\xd1\xa2\x90\xaf\xc5\x91\xe6" 9) "\xcc\xbc\xf4\xcc\xa6" 10) "\x99\xf6\xc4\x8e\xb6\xec\x86\x86\x97"

127.0.0.1:12301> sort "\xeb" ALPHA 1) "\xd3" 2) "\x8b" 3) "\x88\xe9\x8d" 4) "\xbb\xec\xb2\xba\xcf" 5) "\xde\x8f\xbd\xda\xb7" 6) "\xcc\xbc\xf4\xcc\xa6" 7) "\x99\xf6\xc4\x8e\xb6\xec\x86\x86\x97" 8) "\xd1\xa2\x90\xaf\xc5\x91\xe6" 9) "\xc6\xd7\x90\xd4\xd0\xcf\x9f\xd5" 10) "\xc4\xec\xb9\xb1\xfb\xef\x96\xa0\x8b\xd7\x91"

Comment From: danielkop

"Redis is UTF-8 aware, assuming you correctly set the !LC_COLLATE environment variable." Might be possible that redis is interpreting your strings as UTF-8 (in which case most of them are invalid utf-8), and can't really sort them.

Take: "\xd3" "\x8b" For example. Neither of them are valid utf-8 chars (One-byte codes are used only for the ASCII values 0 through 127). Comparing them is meaningless, so they're impossible to sort.

Comment From: yoav-steinberg

@danielkop's right. I'm closing this.