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

Mishandles encodings that are not a superset of ascii #430

Closed
p opened this issue Jan 26, 2014 · 4 comments
Closed

Mishandles encodings that are not a superset of ascii #430

p opened this issue Jan 26, 2014 · 4 comments

Comments

@p
Copy link
Contributor

p commented Jan 26, 2014

redis-py 2.9.1:

>>> import redis
>>> c=redis.Redis(charset='utf-16')
>>> c.set('hello','world')
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/sandbox/33/lib/python3.3/site-packages/redis/client.py", line 897, in set
    return self.execute_command('SET', *pieces)
  File "/home/sandbox/33/lib/python3.3/site-packages/redis/client.py", line 461, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/home/sandbox/33/lib/python3.3/site-packages/redis/client.py", line 471, in parse_response
    response = connection.read_response()
  File "/home/sandbox/33/lib/python3.3/site-packages/redis/connection.py", line 344, in read_response
    raise response
redis.exceptions.ResponseError: unknown command '\ufffd\ufffdS'

It looks like redis encodes command itself using the configured encoding, but encoding should only apply to user data (keys/values).

p added a commit to p-push/redis-dump-load that referenced this issue Jan 27, 2014
p added a commit to p-push/redis-dump-load that referenced this issue Jan 27, 2014
p added a commit to p-push/redis-dump-load that referenced this issue Jan 27, 2014
@andymccurdy
Copy link
Contributor

Looks like this is isolated to Python 3. I suspect that you're on the right track -- the entire command string gets encoded rather than just the user supplied data.

@p
Copy link
Contributor Author

p commented Jan 27, 2014

Yes, python 2 works.

@andymccurdy
Copy link
Contributor

@p I just pushed a fix for this. If you have a few minutes to look at it/test it in your setup I'd really appreciate it. Let me know what you find!

p added a commit to p/redis-dump-load that referenced this issue Apr 26, 2015
@p
Copy link
Contributor Author

p commented Apr 26, 2015

@andymccurdy the fix works, thank you!

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

2 participants