Skip to content

zrangebylex and zadd are not encoding values the same way #361

@madgnome

Description

@madgnome

zadd encodes value using addValue but zrangebylex and co. encodes them as string using add(String s). As a result it's impossible to get results for unicode values out of the ascii range.

    // Add this test to SortedSetCommandTest
    @Test
    public void zrangebylexUnicode() throws Exception {

        redis.zadd(key, 0d, "a");
        redis.zadd(key, 0d, "富");

        List<String> result = redis.zrangebylex(key, "[a", "[a\uFFFF");
        assertThat(result).hasSize(1);

        result = redis.zrangebylex(key, "[富", "[富\uFFFF");
        assertThat(result).hasSize(1); // This will fail
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions