diff --git a/python/src/cloudstorage/storage_api.py b/python/src/cloudstorage/storage_api.py index 26254fd..abfa8f9 100644 --- a/python/src/cloudstorage/storage_api.py +++ b/python/src/cloudstorage/storage_api.py @@ -759,7 +759,9 @@ def write(self, data): TypeError: if data is not of type str. """ self._check_open() - if not isinstance(data, str): + if isinstance(data, unicode): + data = data.encode('utf-8') + elif not isinstance(data, str): raise TypeError('Expected str but got %s.' % type(data)) if not data: return