Skip to content

LC_COLLATE for SORT? #176

Closed
Closed

Description

@adammada

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?

Activity

  1. adammada commented on Nov 16, 2011

    @adammada
    Author

    Help. Please!

  2. scobrown commented on Sep 18, 2012

    @scobrown

    I am also having problems changing collation. Really need some help here.

    Changing the LC_COLLATE variable seems to have no affect.
    CentOS
    Redis 2.4.17

  3. baina commented on Nov 29, 2012

    @baina

    Help. Please!

  4. added a commit that references this issue on Nov 29, 2012
  5. charsyam commented on Nov 29, 2012

    @charsyam
    Contributor

    @adammada @scobrown @baina I registered a patch to fix this bug.
    please test my patch.
    https://github.com/antirez/redis/pull/799
    I just check @adammada 's case. but it works well with this patch.

  6. yoav-steinberg commented on Jun 8, 2021

    @yoav-steinberg
    Contributor

    This has been since fixed. Closing.

  7. added a commit that references this issue on Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions