diff -r 3b67f41e85b7 django/core/cache/backends/memcached.py
--- a/django/core/cache/backends/memcached.py	Thu Oct 09 09:30:54 2008 +0000
+++ b/django/core/cache/backends/memcached.py	Tue Oct 14 09:30:10 2008 -0400
@@ -1,7 +1,7 @@
 "Memcached cache backend"
 
 from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
-from django.utils.encoding import smart_unicode, smart_str
+from django.utils.encoding import smart_unicode, smart_str, DjangoUnicodeDecodeError
 
 try:
     import cmemcache as memcache
@@ -27,7 +27,10 @@
             return default
         else:
             if isinstance(val, basestring):
-                return smart_unicode(val)
+                try:
+                    return smart_unicode(val)
+                except DjangoUnicodeDecodeError:
+                    return val
             else:
                 return val
 
diff -r 3b67f41e85b7 tests/regressiontests/cache/tests.py
--- a/tests/regressiontests/cache/tests.py	Thu Oct 09 09:30:54 2008 +0000
+++ b/tests/regressiontests/cache/tests.py	Tue Oct 14 09:30:10 2008 -0400
@@ -21,6 +21,10 @@
 class C:
     def m(n):
         return 24
+
+# The simplest possible GIF: a 43-byte, 1x1-pixel transparent image
+EMPTY_GIF_BYTES = 'GIF89a\x01\x00\x01\x00\xf0\x00\x00\xb0\x8cZ\x00\x00\x00!\xf9\x04\x00\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;'
+
 
 class Cache(unittest.TestCase):
     def test_simple(self):
@@ -105,6 +109,10 @@
             cache.set(key, value)
             self.assertEqual(cache.get(key), value)
 
+    def test_binary(self):
+        cache.set("binary_stuff", EMPTY_GIF_BYTES)
+        self.assertEqual(cache.get("binary_stuff"), EMPTY_GIF_BYTES)
+
 
 class FileBasedCacheTests(unittest.TestCase):
     """
