antirez/redis — Issue #176: LC_COLLATE for SORT?
Author: adammada
Created: 2011-11-07 10:22:44+00:00
State: open

Hi,

i'm trying to make Redis use LC_COLLATE for SORT command, accroding to docs

" Redis is UTF-8 aware, assuming you correctly set the !LC_COLLATE environment variable. "

I'm using Ubuntu 11.04. I have locales installed:

> locale -a
C
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8
pl_PL.utf8
POSIX

I set LC_COLLATE in /etc/enviroment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
LANG="pl_PL.UTF-8"
LC_COLLATE="pl_PL.utf8"

so after reboot i have:

> printenv LC_COLLATE
pl_PL.utf8

But redis doesnt sort correctly:

redis> LPUSH test adam
(integer) 1
redis> LPUSH test łukasz
(integer) 2
redis> LPUSH test zuzanna
(integer) 3

redis> SORT test ALPHA
1) "adam"
2) "zuzanna"
3) "\xc5\x82ukasz"

- it should be adam, łukasz, zuzanna .

redis> info
redis_version:2.2.4
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:32
multiplexing_api:epoll
process_id:3747
uptime_in_seconds:146
uptime_in_days:0
lru_clock:2042708
used_cpu_sys:0.06
used_cpu_user:0.06
used_cpu_sys_childrens:0.00
used_cpu_user_childrens:0.00
connected_clients:2
connected_slaves:0
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
used_memory:555404
used_memory_human:542.39K
used_memory_rss:1241088
mem_fragmentation_ratio:2.23
use_tcmalloc:0
loading:0
aof_enabled:0
changes_since_last_save:3
bgsave_in_progress:0
last_save_time:1320661175
bgrewriteaof_in_progress:0
total_connections_received:4
total_commands_processed:133
expired_keys:0
evicted_keys:0
keyspace_hits:8
keyspace_misses:122
hash_max_zipmap_entries:512
hash_max_zipmap_value:64
pubsub_channels:0
pubsub_patterns:0
vm_enabled:0
role:master
allocation_stats:4=30,6=1,7=1,8=158,9=70,10=58,11=113,12=10482,13=181,14=30,15=80,16=52,17=11,18=6,19=16,20=10,21=5,22=5,23=34,24=32,25=4,26=8,27=3,28=6,29=7,30=5,31=2,32=126,34=6,35=2,36=11,37=3,38=7,39=14,40=4,41=3,42=2,43=2,44=2,45=1,46=1,47=1,48=71,49=2,50=1,51=1,52=1,53=2,55=3,56=4,57=2,58=3,59=5,61=1,62=1,63=1,64=3,65=3,66=1,67=1,68=4,69=4,70=2,71=3,72=6,73=4,74=3,75=1,76=3,77=3,78=7,79=8,80=13,81=18,82=20,83=9,84=25,85=18,86=15,87=12,88=7,89=9,90=3,128=2,>=256=13
db0:keys=1,expires=0

What im doing wrong? How to check it?