Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the encoding format used for keys written in binary-safe mode in Redis? #66

Open
Neeraj0019 opened this issue Aug 3, 2023 · 0 comments

Comments

@Neeraj0019
Copy link

We have some redis Hash keys which are storing values as c++ structures and for that we have used binary safe mode.
Example:

redisReply* reply = (redisReply*)redisCommand(ctxt, "HMSET %b %b %b", KEY.c_str(), strlen(KEY.c_str()), &val,
                                            sizeof(KEY), &temp_element, sizeof(temp_element));

keys looks like this in redis DB:

  1. "\x14\x10"
  2. "KEY_dc8d8afe8e2a_301_0.4116_ECpriReceptionMonitor\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"

Where KEY is integer value and temp_element is a structure.

But when we try to take dump using redisdl module as show below:

db_dump=redisdl.dumps(db=db_instance,pretty=True)

it gives below error:

'utf-8' codec can't decode byte 0x90 in position 1: invalid start byte

we tried with encoding='iso-8859-1' seems to work but how to check if this is the correct encoding format?

Br,
Neeraj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant