﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13622	Caching unicode characters with Memcached no longer works	Chris Targett <chris@…>	nobody	"Since updating to Django 1.2.0 I am no longer able to cache unicode characters using the Memcached backend.

{{{
>>> from django import VERSION
>>> VERSION
(1, 1, 1, 'final', 0)
>>> import memcache
>>> memcache.__version__
'1.31'
>>>
>>> from django.core.cache import cache
>>> cache.set('test_key', u'\u2026')
>>> cache.get('test_key')
u'\u2026'
>>>




>>> from django import VERSION
>>> VERSION
(1, 2, 0, 'final', 0)
>>> import memcache
>>> memcache.__version__
'1.31'
>>>
>>> from django.core.cache import cache
>>> cache.set('test_key', u'\u2026')
Traceback (most recent call last):
  File ""<console>"", line 1, in ?
  File ""/export/www/wwwroot/staging/django/staging6/code/valiant/core/cache/backends/prefix_wrapper.py"", line 39, in set
    return self.backend.set(key, value, timeout)
  File ""/export/www/wwwroot/staging/django/staging6/code/django/core/cache/backends/memcached.py"", line 54, in set
    self._cache.set(smart_str(key), value, self._get_memcache_timeout(timeout))
  File ""/usr/lib/python2.4/site-packages/memcache.py"", line 293, in set
    return self._set(""set"", key, val, time)
  File ""/usr/lib/python2.4/site-packages/memcache.py"", line 317, in _set
    server.send_cmd(fullcmd)
  File ""/usr/lib/python2.4/site-packages/memcache.py"", line 507, in send_cmd
    self.socket.sendall(cmd + '\r\n')
  File ""<string>"", line 1, in sendall
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 40: ordinal not in range(128)
>>>
}}}

After reverting the changes here http://code.djangoproject.com/changeset/12637/django/trunk/django/core/cache/backends/memcached.py things seem to work again."		closed	Core (Cache system)	1.2		worksforme	memcached		Accepted	0	0	0	0	0	0
