From 328e7611d39ad989435e3fa6c1aa32879185c515 Mon Sep 17 00:00:00 2001 From: Alex Morega Date: Wed, 7 Aug 2013 00:10:54 +0300 Subject: [PATCH] use utf-8 instead of ascii --- rq/compat/__init__.py | 2 +- rq/job.py | 2 +- tests/test_job.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rq/compat/__init__.py b/rq/compat/__init__.py index 9ce6e4e..ac9b7a9 100644 --- a/rq/compat/__init__.py +++ b/rq/compat/__init__.py @@ -61,7 +61,7 @@ else: if v is None: return None elif isinstance(v, bytes): - return v.decode('ascii') + return v.decode('utf-8') elif isinstance(v, str): return v else: diff --git a/rq/job.py b/rq/job.py index 6bf9189..42653e0 100644 --- a/rq/job.py +++ b/rq/job.py @@ -210,7 +210,7 @@ class Job(object): @classmethod def key_for(cls, job_id): """The Redis key that is used to store job hash under.""" - return b'rq:job:' + job_id.encode('ascii') + return b'rq:job:' + job_id.encode('utf-8') @property def key(self): diff --git a/tests/test_job.py b/tests/test_job.py index 522f1a6..0f376ec 100644 --- a/tests/test_job.py +++ b/tests/test_job.py @@ -108,7 +108,7 @@ class TestJob(RQTestCase): job.save() expected_date = strip_milliseconds(job.created_at) - stored_date = self.testconn.hget(job.key, 'created_at').decode('ascii') + stored_date = self.testconn.hget(job.key, 'created_at').decode('utf-8') self.assertEquals( times.to_universal(stored_date), expected_date) @@ -124,7 +124,7 @@ class TestJob(RQTestCase): job.save() expected_date = strip_milliseconds(job.created_at) - stored_date = self.testconn.hget(job.key, 'created_at').decode('ascii') + stored_date = self.testconn.hget(job.key, 'created_at').decode('utf-8') self.assertEquals( times.to_universal(stored_date), expected_date)