Index: boto/sdb/db/blob.py |
diff --git a/boto/sdb/db/blob.py b/boto/sdb/db/blob.py |
index 45a3624a6795a6c30c7786ca2f4dc42e9bf24b8d..b50794c9610545699c3cb2541db155f37e92ea13 100644 |
--- a/boto/sdb/db/blob.py |
+++ b/boto/sdb/db/blob.py |
@@ -37,17 +37,24 @@ class Blob(object): |
return f |
def __str__(self): |
+ return unicode(self).encode('utf-8') |
+ |
+ def __unicode__(self): |
if hasattr(self.file, "get_contents_as_string"): |
value = self.file.get_contents_as_string() |
else: |
value = self.file.getvalue() |
- try: |
- return str(value) |
- except: |
- return unicode(value) |
+ if isinstance(value, unicode): |
+ return value |
+ else: |
+ return value.decode('utf-8') |
+ |
def read(self): |
- return self.file.read() |
+ if hasattr(self.file, "get_contents_as_string"): |
+ return self.file.get_contents_as_string() |
+ else: |
+ return self.file.read() |
def readline(self): |
return self.file.readline() |